1 !function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var t;t="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,t.Tangram=e()}}(function(){var e;return function t(e,r,n){function i(o,s){if(!r[o]){if(!e[o]){var l="function"==typeof require&&require;if(!s&&l)return l(o,!0);if(a)return a(o,!0);var u=new Error("Cannot find module '"+o+"'");throw u.code="MODULE_NOT_FOUND",u}var c=r[o]={exports:{}};e[o][0].call(c.exports,function(t){var r=e[o][1][t];return i(r?r:t)},c,c.exports,t,e,r,n)}return r[o].exports}for(var a="function"==typeof require&&require,o=0;o<n.length;o++)i(n[o]);return i}({1:[function(e,t){"use strict";function r(){if(s.length)throw s.shift()}function n(e){var t;t=o.length?o.pop():new i,t.task=e,a(t)}function i(){this.task=null}var a=e("./raw"),o=[],s=[],l=a.makeRequestCallFromTimer(r);t.exports=n,i.prototype.call=function(){try{this.task.call()}catch(e){n.onerror?n.onerror(e):(s.push(e),l())}finally{this.task=null,o[o.length]=this}}},{"./raw":2}],2:[function(e,t){(function(e){"use strict";function r(e){s.length||(o(),l=!0),s[s.length]=e}function n(){for(;u<s.length;){var e=u;if(u+=1,s[e].call(),u>c){for(var t=0,r=s.length-u;r>t;t++)s[t]=s[t+u];s.length-=u,u=0}}s.length=0,u=0,l=!1}function i(e){var t=1,r=new f(e),n=document.createTextNode("");return r.observe(n,{characterData:!0}),function(){t=-t,n.data=t}}function a(e){return function(){function t(){clearTimeout(r),clearInterval(n),e()}var r=setTimeout(t,0),n=setInterval(t,50)}}t.exports=r;var o,s=[],l=!1,u=0,c=1024,f=e.MutationObserver||e.WebKitMutationObserver;o="function"==typeof f?i(n):a(n),r.requestFlush=o,r.makeRequestCallFromTimer=a}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],3:[function(e,t){t.exports={"default":e("core-js/library/fn/array/from"),__esModule:!0}},{"core-js/library/fn/array/from":42}],4:[function(e,t){t.exports={"default":e("core-js/library/fn/get-iterator"),__esModule:!0}},{"core-js/library/fn/get-iterator":43}],5:[function(e,t){t.exports={"default":e("core-js/library/fn/is-iterable"),__esModule:!0}},{"core-js/library/fn/is-iterable":44}],6:[function(e,t){t.exports={"default":e("core-js/library/fn/json/stringify"),__esModule:!0}},{"core-js/library/fn/json/stringify":45}],7:[function(e,t){t.exports={"default":e("core-js/library/fn/map"),__esModule:!0}},{"core-js/library/fn/map":46}],8:[function(e,t){t.exports={"default":e("core-js/library/fn/math/log2"),__esModule:!0}},{"core-js/library/fn/math/log2":47}],9:[function(e,t){t.exports={"default":e("core-js/library/fn/object/assign"),__esModule:!0}},{"core-js/library/fn/object/assign":48}],10:[function(e,t){t.exports={"default":e("core-js/library/fn/object/create"),__esModule:!0}},{"core-js/library/fn/object/create":49}],11:[function(e,t){t.exports={"default":e("core-js/library/fn/object/define-property"),__esModule:!0}},{"core-js/library/fn/object/define-property":50}],12:[function(e,t){t.exports={"default":e("core-js/library/fn/object/freeze"),__esModule:!0}},{"core-js/library/fn/object/freeze":51}],13:[function(e,t){t.exports={"default":e("core-js/library/fn/object/get-own-property-descriptor"),__esModule:!0}},{"core-js/library/fn/object/get-own-property-descriptor":52}],14:[function(e,t){t.exports={"default":e("core-js/library/fn/object/get-prototype-of"),__esModule:!0}},{"core-js/library/fn/object/get-prototype-of":53}],15:[function(e,t){t.exports={"default":e("core-js/library/fn/object/keys"),__esModule:!0}},{"core-js/library/fn/object/keys":54}],16:[function(e,t){t.exports={"default":e("core-js/library/fn/object/set-prototype-of"),__esModule:!0}},{"core-js/library/fn/object/set-prototype-of":55}],17:[function(e,t){t.exports={"default":e("core-js/library/fn/promise"),__esModule:!0}},{"core-js/library/fn/promise":56}],18:[function(e,t){t.exports={"default":e("core-js/library/fn/set"),__esModule:!0}},{"core-js/library/fn/set":57}],19:[function(e,t){t.exports={"default":e("core-js/library/fn/symbol"),__esModule:!0}},{"core-js/library/fn/symbol":58}],20:[function(e,t){t.exports={"default":e("core-js/library/fn/symbol/iterator"),__esModule:!0}},{"core-js/library/fn/symbol/iterator":59}],21:[function(e,t,r){"use strict";r.__esModule=!0,r.default=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}},{}],22:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}r.__esModule=!0;var i=e("../core-js/object/define-property"),a=n(i);r.default=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),a.default(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}()},{"../core-js/object/define-property":11}],23:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}r.__esModule=!0;var i=e("../core-js/object/define-property"),a=n(i);r.default=function(e,t,r){return t in e?a.default(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}},{"../core-js/object/define-property":11}],24:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}r.__esModule=!0;var i=e("../core-js/object/get-prototype-of"),a=n(i),o=e("../core-js/object/get-own-property-descriptor"),s=n(o);r.default=function l(e,t,r){null===e&&(e=Function.prototype);var n=s.default(e,t);if(void 0===n){var i=a.default(e);return null===i?void 0:l(i,t,r)}if("value"in n)return n.value;var o=n.get;return void 0===o?void 0:o.call(r)}},{"../core-js/object/get-own-property-descriptor":13,"../core-js/object/get-prototype-of":14}],25:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}r.__esModule=!0;var i=e("../core-js/object/set-prototype-of"),a=n(i),o=e("../core-js/object/create"),s=n(o),l=e("../helpers/typeof"),u=n(l);r.default=function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+("undefined"==typeof t?"undefined":u.default(t)));e.prototype=s.default(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(a.default?a.default(e,t):e.__proto__=t)}},{"../core-js/object/create":10,"../core-js/object/set-prototype-of":16,"../helpers/typeof":29}],26:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}r.__esModule=!0;var i=e("../helpers/typeof"),a=n(i);r.default=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!==("undefined"==typeof t?"undefined":a.default(t))&&"function"!=typeof t?e:t}},{"../helpers/typeof":29}],27:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}r.__esModule=!0;var i=e("../core-js/is-iterable"),a=n(i),o=e("../core-js/get-iterator"),s=n(o);r.default=function(){function e(e,t){var r=[],n=!0,i=!1,a=void 0;try{for(var o,l=s.default(e);!(n=(o=l.next()).done)&&(r.push(o.value),!t||r.length!==t);n=!0);}catch(u){i=!0,a=u}finally{try{!n&&l["return"]&&l["return"]()}finally{if(i)throw a}}return r}return function(t,r){if(Array.isArray(t))return t;if(a.default(Object(t)))return e(t,r);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}()},{"../core-js/get-iterator":4,"../core-js/is-iterable":5}],28:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}r.__esModule=!0;var i=e("../core-js/array/from"),a=n(i);r.default=function(e){if(Array.isArray(e)){for(var t=0,r=Array(e.length);t<e.length;t++)r[t]=e[t];return r}return a.default(e)}},{"../core-js/array/from":3}],29:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}r.__esModule=!0;var i=e("../core-js/symbol/iterator"),a=n(i),o=e("../core-js/symbol"),s=n(o),l="function"==typeof s.default&&"symbol"==typeof a.default?function(e){return typeof e}:function(e){return e&&"function"==typeof s.default&&e.constructor===s.default?"symbol":typeof e};r.default="function"==typeof s.default&&"symbol"===l(a.default)?function(e){return"undefined"==typeof e?"undefined":l(e)}:function(e){return e&&"function"==typeof s.default&&e.constructor===s.default?"symbol":"undefined"==typeof e?"undefined":l(e)}},{"../core-js/symbol":19,"../core-js/symbol/iterator":20}],30:[function(e,t){t.exports=e("regenerator-runtime")},{"regenerator-runtime":280}],31:[function(e,t,r){"use strict";function n(){for(var e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",t=0,r=e.length;r>t;++t)l[t]=e[t],u[e.charCodeAt(t)]=t;u["-".charCodeAt(0)]=62,u["_".charCodeAt(0)]=63}function i(e){var t,r,n,i,a,o,s=e.length;if(s%4>0)throw new Error("Invalid string. Length must be a multiple of 4");a="="===e[s-2]?2:"="===e[s-1]?1:0,o=new c(3*s/4-a),n=a>0?s-4:s;var l=0;for(t=0,r=0;n>t;t+=4,r+=3)i=u[e.charCodeAt(t)]<<18|u[e.charCodeAt(t+1)]<<12|u[e.charCodeAt(t+2)]<<6|u[e.charCodeAt(t+3)],o[l++]=i>>16&255,o[l++]=i>>8&255,o[l++]=255&i;return 2===a?(i=u[e.charCodeAt(t)]<<2|u[e.charCodeAt(t+1)]>>4,o[l++]=255&i):1===a&&(i=u[e.charCodeAt(t)]<<10|u[e.charCodeAt(t+1)]<<4|u[e.charCodeAt(t+2)]>>2,o[l++]=i>>8&255,o[l++]=255&i),o}function a(e){return l[e>>18&63]+l[e>>12&63]+l[e>>6&63]+l[63&e]}function o(e,t,r){for(var n,i=[],o=t;r>o;o+=3)n=(e[o]<<16)+(e[o+1]<<8)+e[o+2],i.push(a(n));return i.join("")}function s(e){for(var t,r=e.length,n=r%3,i="",a=[],s=16383,u=0,c=r-n;c>u;u+=s)a.push(o(e,u,u+s>c?c:u+s));return 1===n?(t=e[r-1],i+=l[t>>2],i+=l[t<<4&63],i+="=="):2===n&&(t=(e[r-2]<<8)+e[r-1],i+=l[t>>10],i+=l[t>>4&63],i+=l[t<<2&63],i+="="),a.push(i),a.join("")}r.toByteArray=i,r.fromByteArray=s;var l=[],u=[],c="undefined"!=typeof Uint8Array?Uint8Array:Array;n()},{}],32:[function(e,t,r){"use strict";"use restrict";function n(e){var t=32;return e&=-e,e&&t--,65535&e&&(t-=16),16711935&e&&(t-=8),252645135&e&&(t-=4),858993459&e&&(t-=2),1431655765&e&&(t-=1),t}var i=32;r.INT_BITS=i,r.INT_MAX=2147483647,r.INT_MIN=-1<<i-1,r.sign=function(e){return(e>0)-(0>e)},r.abs=function(e){var t=e>>i-1;return(e^t)-t},r.min=function(e,t){return t^(e^t)&-(t>e)},r.max=function(e,t){return e^(e^t)&-(t>e)},r.isPow2=function(e){return!(e&e-1||!e)},r.log2=function(e){var t,r;return t=(e>65535)<<4,e>>>=t,r=(e>255)<<3,e>>>=r,t|=r,r=(e>15)<<2,e>>>=r,t|=r,r=(e>3)<<1,e>>>=r,t|=r,t|e>>1},r.log10=function(e){return e>=1e9?9:e>=1e8?8:e>=1e7?7:e>=1e6?6:e>=1e5?5:e>=1e4?4:e>=1e3?3:e>=100?2:e>=10?1:0},r.popCount=function(e){return e-=e>>>1&1431655765,e=(858993459&e)+(e>>>2&858993459),16843009*(e+(e>>>4)&252645135)>>>24},r.countTrailingZeros=n,r.nextPow2=function(e){return e+=0===e,--e,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e+1},r.prevPow2=function(e){return e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e-(e>>>1)},r.parity=function(e){return e^=e>>>16,e^=e>>>8,e^=e>>>4,e&=15,27030>>>e&1};var a=new Array(256);!function(e){for(var t=0;256>t;++t){var r=t,n=t,i=7;for(r>>>=1;r;r>>>=1)n<<=1,n|=1&r,--i;e[t]=n<<i&255}}(a),r.reverse=function(e){return a[255&e]<<24|a[e>>>8&255]<<16|a[e>>>16&255]<<8|a[e>>>24&255]},r.interleave2=function(e,t){return e&=65535,e=16711935&(e|e<<8),e=252645135&(e|e<<4),e=858993459&(e|e<<2),e=1431655765&(e|e<<1),t&=65535,t=16711935&(t|t<<8),t=252645135&(t|t<<4),t=858993459&(t|t<<2),t=1431655765&(t|t<<1),e|t<<1},r.deinterleave2=function(e,t){return e=e>>>t&1431655765,e=858993459&(e|e>>>1),e=252645135&(e|e>>>2),e=16711935&(e|e>>>4),e=65535&(e|e>>>16),e<<16>>16},r.interleave3=function(e,t,r){return e&=1023,e=4278190335&(e|e<<16),e=251719695&(e|e<<8),e=3272356035&(e|e<<4),e=1227133513&(e|e<<2),t&=1023,t=4278190335&(t|t<<16),t=251719695&(t|t<<8),t=3272356035&(t|t<<4),t=1227133513&(t|t<<2),e|=t<<1,r&=1023,r=4278190335&(r|r<<16),r=251719695&(r|r<<8),r=3272356035&(r|r<<4),r=1227133513&(r|r<<2),e|r<<2},r.deinterleave3=function(e,t){return e=e>>>t&1227133513,e=3272356035&(e|e>>>2),e=251719695&(e|e>>>4),e=4278190335&(e|e>>>8),e=1023&(e|e>>>16),e<<22>>22},r.nextCombination=function(e){var t=e|e-1;return t+1|(~t&-~t)-1>>>n(e)+1}},{}],33:[function(e,t){"use strict";function r(e,t){for(var r=0;e>r;++r)if(!(t[r]<=t[r+e]))return!0;return!1}function n(e,t,n,i){for(var a=0,o=0,s=0,l=e.length;l>s;++s){var u=e[s];if(!r(t,u)){for(var c=0;2*t>c;++c)n[a++]=u[c];i[o++]=s}}return o}function i(e,t,r,i){var a=e.length,u=t.length;if(!(0>=a||0>=u)){var c=e[0].length>>>1;if(!(0>=c)){var f,h=o.mallocDouble(2*c*a),d=o.mallocInt32(a);if(a=n(e,c,h,d),a>0){if(1===c&&i)s.init(a),f=s.sweepComplete(c,r,0,a,h,d,0,a,h,d);else{var p=o.mallocDouble(2*c*u),m=o.mallocInt32(u);u=n(t,c,p,m),u>0&&(s.init(a+u),f=1===c?s.sweepBipartite(c,r,0,a,h,d,0,u,p,m):l(c,r,i,a,h,d,u,p,m),o.free(p),o.free(m))}o.free(h),o.free(d)}return f}}}function a(e,t,r){var n;switch(arguments.length){case 1:return n=[],i(e,e,function(e,t){n.push([e,t])},!0),n;case 2:if("function"==typeof t){var a=t;return i(e,e,a,!0)}return n=[],i(e,t,function(e,t){n.push([e,t])},!1),n;case 3:return i(e,t,r,!1);default:throw new Error("box-intersect: Invalid arguments")}}t.exports=a;var o=e("typedarray-pool"),s=e("./lib/sweep"),l=e("./lib/intersect")},{"./lib/intersect":35,"./lib/sweep":39,"typedarray-pool":285}],34:[function(e,t,r){"use strict";function n(e,t,r){var n="bruteForce"+(e?"Red":"Blue")+(t?"Flip":"")+(r?"Full":""),i=["function ",n,"(",w.join(),"){","var ",u,"=2*",a,";"],l="for(var i="+c+","+p+"="+u+"*"+c+";i<"+f+";++i,"+p+"+="+u+"){var x0="+h+"["+o+"+"+p+"],x1="+h+"["+o+"+"+p+"+"+a+"],xi="+d+"[i];",k="for(var j="+m+","+y+"="+u+"*"+m+";j<"+_+";++j,"+y+"+="+u+"){var y0="+g+"["+o+"+"+y+"],"+(r?"y1="+g+"["+o+"+"+y+"+"+a+"],":"")+"yi="+v+"[j];";return e?i.push(l,x,":",k):i.push(k,x,":",l),i.push(r?"if(y1<x0||x1<y0)continue;":t?"if(y0<=x0||x1<y0)continue;":"if(y0<x0||x1<y0)continue;"),i.push("for(var k="+o+"+1;k<"+a+";++k){var r0="+h+"[k+"+p+"],r1="+h+"[k+"+a+"+"+p+"],b0="+g+"[k+"+y+"],b1="+g+"[k+"+a+"+"+y+"];if(r1<b0||b1<r0)continue "+x+";}var "+b+"="+s+"("),i.push(t?"yi,xi":"xi,yi"),i.push(");if("+b+"!==void 0)return "+b+";}}}"),{name:n,code:i.join("")}}function i(e){function t(t,r){var a=n(t,r,e);i.push(a.code),o.push("return "+a.name+"("+w.join()+");")}var r="bruteForce"+(e?"Full":"Partial"),i=[],a=w.slice();e||a.splice(3,0,l);var o=["function "+r+"("+a.join()+"){"];o.push("if("+f+"-"+c+">"+_+"-"+m+"){"),e?(t(!0,!1),o.push("}else{"),t(!1,!1)):(o.push("if("+l+"){"),t(!0,!0),o.push("}else{"),t(!0,!1),o.push("}}else{if("+l+"){"),t(!1,!0),o.push("}else{"),t(!1,!1),o.push("}")),o.push("}}return "+r);var s=i.join("")+o.join(""),u=new Function(s);return u()}var a="d",o="ax",s="vv",l="fp",u="es",c="rs",f="re",h="rb",d="ri",p="rp",m="bs",_="be",g="bb",v="bi",y="bp",b="rv",x="Q",w=[a,o,s,c,f,h,d,m,_,g,v];r.partial=i(!1),r.full=i(!0)},{}],35:[function(e,t){"use strict";function r(e,t){var r=8*l.log2(t+1)*(e+1)|0,n=l.nextPow2(A*r);S.length<n&&(s.free(S),S=s.mallocInt32(n));var i=l.nextPow2(T*r);i>R&&(s.free(R),R=s.mallocDouble(i))}function n(e,t,r,n,i,a,o,s,l){var u=A*e;S[u]=t,S[u+1]=r,S[u+2]=n,S[u+3]=i,S[u+4]=a,S[u+5]=o;var c=T*e;R[c]=s,R[c+1]=l}function i(e,t,r,n,i,a,o,s,l,u,c){var f=2*e,h=l*f,d=u[h+t];e:for(var p=i,m=i*f;a>p;++p,m+=f){var _=o[m+t],g=o[m+t+e];if(!(_>d||d>g||n&&d===_)){for(var v=s[p],y=t+1;e>y;++y){var _=o[m+y],g=o[m+y+e],b=u[h+y],x=u[h+y+e];if(b>g||_>x)continue e}var w;if(w=n?r(c,v):r(v,c),void 0!==w)return w}}}function a(e,t,r,n,i,a,o,s,l,u){var c=2*e,f=s*c,h=l[f+t];e:for(var d=n,p=n*c;i>d;++d,p+=c){var m=o[d];if(m!==u){var _=a[p+t],g=a[p+t+e];if(!(_>h||h>g)){for(var v=t+1;e>v;++v){var _=a[p+v],g=a[p+v+e],y=l[f+v],b=l[f+v+e];if(y>g||_>b)continue e}var x=r(m,u);if(void 0!==x)return x}}}}function o(e,t,o,s,l,u,p,E,j){r(e,s+p);var M,z=0,C=2*e;for(n(z++,0,0,s,0,p,o?16:0,-1/0,1/0),o||n(z++,0,0,p,0,s,1,-1/0,1/0);z>0;){z-=1;var P=z*A,N=S[P],L=S[P+1],O=S[P+2],I=S[P+3],F=S[P+4],U=S[P+5],D=z*T,B=R[D],G=R[D+1],V=1&U,W=!!(16&U),q=l,Z=u,H=E,X=j;if(V&&(q=E,Z=j,H=l,X=u),!(2&U&&(O=b(e,N,L,O,q,Z,G),L>=O)||4&U&&(L=x(e,N,L,O,q,Z,B),L>=O))){var Y=O-L,J=F-I;if(W){if(g>e*Y*(Y+J)){if(M=h.scanComplete(e,N,t,L,O,q,Z,I,F,H,X),void 0!==M)return M;continue}}else{if(e*Math.min(Y,J)<m){if(M=c(e,N,t,V,L,O,q,Z,I,F,H,X),void 0!==M)return M;continue}if(_>e*Y*J){if(M=h.scanBipartite(e,N,t,V,L,O,q,Z,I,F,H,X),void 0!==M)return M;continue}}var K=v(e,N,L,O,q,Z,B,G);if(K>L)if(m>e*(K-L)){if(M=f(e,N+1,t,L,K,q,Z,I,F,H,X),void 0!==M)return M}else if(N===e-2){if(M=V?h.sweepBipartite(e,t,I,F,H,X,L,K,q,Z):h.sweepBipartite(e,t,L,K,q,Z,I,F,H,X),void 0!==M)return M}else n(z++,N+1,L,K,I,F,V,-1/0,1/0),n(z++,N+1,I,F,L,K,1^V,-1/0,1/0);if(O>K){var $=d(e,N,I,F,H,X),Q=H[C*$+N],et=y(e,N,$,F,H,X,Q);if(F>et&&n(z++,N,K,O,et,F,(4|V)+(W?16:0),Q,G),$>I&&n(z++,N,K,O,I,$,(2|V)+(W?16:0),B,Q),$+1===et){if(M=W?a(e,N,t,K,O,q,Z,$,H,X[$]):i(e,N,t,V,K,O,q,Z,$,H,X[$]),void 0!==M)return M}else if(et>$){var tt;if(W){if(tt=w(e,N,K,O,q,Z,Q),tt>K){var rt=y(e,N,K,tt,q,Z,Q);if(N===e-2){if(rt>K&&(M=h.sweepComplete(e,t,K,rt,q,Z,$,et,H,X),void 0!==M))return M;if(tt>rt&&(M=h.sweepBipartite(e,t,rt,tt,q,Z,$,et,H,X),void 0!==M))return M}else rt>K&&n(z++,N+1,K,rt,$,et,16,-1/0,1/0),tt>rt&&(n(z++,N+1,rt,tt,$,et,0,-1/0,1/0),n(z++,N+1,$,et,rt,tt,1,-1/0,1/0))}}else tt=V?k(e,N,K,O,q,Z,Q):w(e,N,K,O,q,Z,Q),tt>K&&(N===e-2?M=V?h.sweepBipartite(e,t,$,et,H,X,K,tt,q,Z):h.sweepBipartite(e,t,K,tt,q,Z,$,et,H,X):(n(z++,N+1,K,tt,$,et,V,-1/0,1/0),n(z++,N+1,$,et,K,tt,1^V,-1/0,1/0)))}}}}}t.exports=o;var s=e("typedarray-pool"),l=e("bit-twiddle"),u=e("./brute"),c=u.partial,f=u.full,h=e("./sweep"),d=e("./median"),p=e("./partition"),m=128,_=1<<22,g=1<<22,v=p("!(lo>=p0)&&!(p1>=hi)",["p0","p1"]),y=p("lo===p0",["p0"]),b=p("lo<p0",["p0"]),x=p("hi<=p0",["p0"]),w=p("lo<=p0&&p0<=hi",["p0"]),k=p("lo<p0&&p0<=hi",["p0"]),A=6,T=2,E=1024,S=s.mallocInt32(E),R=s.mallocDouble(E)},{"./brute":34,"./median":36,"./partition":37,"./sweep":39,"bit-twiddle":32,"typedarray-pool":285}],36:[function(e,t){"use strict";function r(e,t,r,n,i,a){for(var o=2*e,s=o*(r+1)+t,l=r+1;n>l;++l,s+=o)for(var u=i[s],c=l,f=o*(l-1);c>r&&i[f+t]>u;--c,f-=o){for(var h=f,d=f+o,p=0;o>p;++p,++h,++d){var m=i[h];i[h]=i[d],i[d]=m}var _=a[c];a[c]=a[c-1],a[c-1]=_}}function n(e,t,n,i,s,l){if(n+1>=i)return n;for(var u=n,c=i,f=i+n>>>1,h=2*e,d=f,p=s[h*f+t];c>u;){if(o>c-u){r(e,t,u,c,s,l),p=s[h*f+t];break}var m=c-u,_=Math.random()*m+u|0,g=s[h*_+t],v=Math.random()*m+u|0,y=s[h*v+t],b=Math.random()*m+u|0,x=s[h*b+t];y>=g?x>=y?(d=v,p=y):g>=x?(d=_,p=g):(d=b,p=x):y>=x?(d=v,p=y):x>=g?(d=_,p=g):(d=b,p=x);for(var w=h*(c-1),k=h*d,A=0;h>A;++A,++w,++k){var T=s[w];s[w]=s[k],s[k]=T}var E=l[c-1];l[c-1]=l[d],l[d]=E,d=a(e,t,u,c-1,s,l,p);for(var w=h*(c-1),k=h*d,A=0;h>A;++A,++w,++k){var T=s[w];s[w]=s[k],s[k]=T}var E=l[c-1];if(l[c-1]=l[d],l[d]=E,d>f){for(c=d-1;c>u&&s[h*(c-1)+t]===p;)c-=1;c+=1}else{if(!(f>d))break;for(u=d+1;c>u&&s[h*u+t]===p;)u+=1}}return a(e,t,n,f,s,l,s[h*f+t])}t.exports=n;var i=e("./partition"),a=i("lo<p0",["p0"]),o=8},{"./partition":37}],37:[function(e,t){"use strict";function r(e,t){var r="abcdef".split("").concat(t),i=[];return e.indexOf("lo")>=0&&i.push("lo=e[k+n]"),e.indexOf("hi")>=0&&i.push("hi=e[k+o]"),r.push(n.replace("_",i.join()).replace("$",e)),Function.apply(void 0,r)}t.exports=r;var n="for(var j=2*a,k=j*c,l=k,m=c,n=b,o=a+b,p=c;d>p;++p,k+=j){var _;if($)if(m===p)m+=1,l+=j;else{for(var s=0;j>s;++s){var t=e[k+s];e[k+s]=e[l],e[l++]=t}var u=f[p];f[p]=f[m],f[m++]=u}}return m"},{}],38:[function(e,t){"use strict";function r(e,t){4*f>=t?n(0,t-1,e):c(0,t-1,e)}function n(e,t,r){for(var n=2*(e+1),i=e+1;t>=i;++i){for(var a=r[n++],o=r[n++],s=i,l=n-2;s-->e;){var u=r[l-2],c=r[l-1];if(a>u)break;if(u===a&&o>c)break;r[l]=u,r[l+1]=c,l-=2}r[l]=a,r[l+1]=o}}function i(e,t,r){e*=2,t*=2;var n=r[e],i=r[e+1];r[e]=r[t],r[e+1]=r[t+1],r[t]=n,r[t+1]=i}function a(e,t,r){e*=2,t*=2,r[e]=r[t],r[e+1]=r[t+1]}function o(e,t,r,n){e*=2,t*=2,r*=2;var i=n[e],a=n[e+1];n[e]=n[t],n[e+1]=n[t+1],n[t]=n[r],n[t+1]=n[r+1],n[r]=i,n[r+1]=a}function s(e,t,r,n,i){e*=2,t*=2,i[e]=i[t],i[t]=r,i[e+1]=i[t+1],i[t+1]=n}function l(e,t,r){e*=2,t*=2;var n=r[e],i=r[t];return i>n?!1:n===i?r[e+1]>r[t+1]:!0}function u(e,t,r,n){e*=2;var i=n[e];return t>i?!0:i===t?n[e+1]<r:!1}function c(e,t,r){var h=(t-e+1)/6|0,d=e+h,p=t-h,m=e+t>>1,_=m-h,g=m+h,v=d,y=_,b=m,x=g,w=p,k=e+1,A=t-1,T=0;l(v,y,r)&&(T=v,v=y,y=T),l(x,w,r)&&(T=x,x=w,w=T),l(v,b,r)&&(T=v,v=b,b=T),l(y,b,r)&&(T=y,y=b,b=T),l(v,x,r)&&(T=v,v=x,x=T),l(b,x,r)&&(T=b,b=x,x=T),l(y,w,r)&&(T=y,y=w,w=T),l(y,b,r)&&(T=y,y=b,b=T),l(x,w,r)&&(T=x,x=w,w=T);for(var E=r[2*y],S=r[2*y+1],R=r[2*x],j=r[2*x+1],M=2*v,z=2*b,C=2*w,P=2*d,N=2*m,L=2*p,O=0;2>O;++O){var I=r[M+O],F=r[z+O],U=r[C+O];r[P+O]=I,r[N+O]=F,r[L+O]=U}a(_,e,r),a(g,t,r);for(var D=k;A>=D;++D)if(u(D,E,S,r))D!==k&&i(D,k,r),++k;else if(!u(D,R,j,r))for(;;){if(u(A,R,j,r)){u(A,E,S,r)?(o(D,k,A,r),++k,--A):(i(D,A,r),--A);break}if(--A<D)break}s(e,k-1,E,S,r),s(t,A+1,R,j,r),f>=k-2-e?n(e,k-2,r):c(e,k-2,r),f>=t-(A+2)?n(A+2,t,r):c(A+2,t,r),f>=A-k?n(k,A,r):c(k,A,r)}t.exports=r;var f=32},{}],39:[function(e,t){"use strict";function r(e){var t=c.nextPow2(e);p.length<t&&(u.free(p),p=u.mallocInt32(t)),m.length<t&&(u.free(m),m=u.mallocInt32(t)),_.length<t&&(u.free(_),_=u.mallocInt32(t)),g.length<t&&(u.free(g),g=u.mallocInt32(t)),v.length<t&&(u.free(v),v=u.mallocInt32(t)),y.length<t&&(u.free(y),y=u.mallocInt32(t));var r=8*t;b.length<r&&(u.free(b),b=u.mallocDouble(r))}function n(e,t,r,n){var i=t[n],a=e[r-1];e[i]=a,t[a]=i}function i(e,t,r,n){e[r]=n,t[n]=r}function a(e,t,r,a,o,s,l,u,c,d){for(var v=0,y=2*e,x=e-1,w=y-1,k=r;a>k;++k){var A=s[k],T=y*k;b[v++]=o[T+x],b[v++]=-(A+1),b[v++]=o[T+w],b[v++]=A}for(var k=l;u>k;++k){var A=d[k]+h,E=y*k;b[v++]=c[E+x],b[v++]=-A,b[v++]=c[E+w],b[v++]=A}var S=v>>>1;f(b,S);for(var R=0,j=0,k=0;S>k;++k){var M=0|b[2*k+1];if(M>=h)M=M-h|0,n(_,g,j--,M);else if(M>=0)n(p,m,R--,M);else if(-h>=M){M=-M-h|0;for(var z=0;R>z;++z){var C=t(p[z],M);if(void 0!==C)return C}i(_,g,j++,M)}else{M=-M-1|0;for(var z=0;j>z;++z){var C=t(M,_[z]);if(void 0!==C)return C}i(p,m,R++,M)}}}function o(e,t,r,a,o,s,l,u,c,h){for(var d=0,x=2*e,w=e-1,k=x-1,A=r;a>A;++A){var T=s[A]+1<<1,E=x*A;b[d++]=o[E+w],b[d++]=-T,b[d++]=o[E+k],b[d++]=T}for(var A=l;u>A;++A){var T=h[A]+1<<1,S=x*A;b[d++]=c[S+w],b[d++]=1|-T,b[d++]=c[S+k],b[d++]=1|T}var R=d>>>1;f(b,R);for(var j=0,M=0,z=0,A=0;R>A;++A){var C=0|b[2*A+1],P=1&C;if(R-1>A&&C>>1===b[2*A+3]>>1&&(P=2,A+=1),0>C){for(var N=-(C>>1)-1,L=0;z>L;++L){var O=t(v[L],N);if(void 0!==O)return O}if(0!==P)for(var L=0;j>L;++L){var O=t(p[L],N);if(void 0!==O)return O}if(1!==P)for(var L=0;M>L;++L){var O=t(_[L],N);if(void 0!==O)return O}0===P?i(p,m,j++,N):1===P?i(_,g,M++,N):2===P&&i(v,y,z++,N)}else{var N=(C>>1)-1;0===P?n(p,m,j--,N):1===P?n(_,g,M--,N):2===P&&n(v,y,z--,N)}}}function s(e,t,r,a,o,s,l,u,c,d,_,g){var v=0,y=2*e,x=t,w=t+e,k=1,A=1;a?A=h:k=h;for(var T=o;s>T;++T){var E=T+k,S=y*T;b[v++]=l[S+x],b[v++]=-E,b[v++]=l[S+w],b[v++]=E}for(var T=c;d>T;++T){var E=T+A,R=y*T;b[v++]=_[R+x],b[v++]=-E}var j=v>>>1;f(b,j);for(var M=0,T=0;j>T;++T){var z=0|b[2*T+1];if(0>z){var E=-z,C=!1;if(E>=h?(C=!a,E-=h):(C=!!a,E-=1),C)i(p,m,M++,E);else{var P=g[E],N=y*E,L=_[N+t+1],O=_[N+t+1+e];e:for(var I=0;M>I;++I){var F=p[I],U=y*F;if(!(O<l[U+t+1]||l[U+t+1+e]<L)){for(var D=t+2;e>D;++D)if(_[N+D+e]<l[U+D]||l[U+D+e]<_[N+D])continue e;var B,G=u[F];if(B=a?r(P,G):r(G,P),void 0!==B)return B}}}}else n(p,m,M--,z-k)}}function l(e,t,r,n,i,a,o,s,l,u,c){for(var d=0,m=2*e,_=t,g=t+e,v=n;i>v;++v){var y=v+h,x=m*v;b[d++]=a[x+_],b[d++]=-y,b[d++]=a[x+g],b[d++]=y}for(var v=s;l>v;++v){var y=v+1,w=m*v;b[d++]=u[w+_],b[d++]=-y}var k=d>>>1;f(b,k);for(var A=0,v=0;k>v;++v){var T=0|b[2*v+1];if(0>T){var y=-T;if(y>=h)p[A++]=y-h;else{y-=1;var E=c[y],S=m*y,R=u[S+t+1],j=u[S+t+1+e];e:for(var M=0;A>M;++M){var z=p[M],C=o[z];if(C===E)break;var P=m*z;if(!(j<a[P+t+1]||a[P+t+1+e]<R)){for(var N=t+2;e>N;++N)if(u[S+N+e]<a[P+N]||a[P+N+e]<u[S+N])continue e;var L=r(C,E);if(void 0!==L)return L}}}}else{for(var y=T-h,M=A-1;M>=0;--M)if(p[M]===y){for(var N=M+1;A>N;++N)p[N-1]=p[N];break}--A}}}t.exports={init:r,sweepBipartite:a,sweepComplete:o,scanBipartite:s,scanComplete:l};var u=e("typedarray-pool"),c=e("bit-twiddle"),f=e("./sort"),h=1<<28,d=1024,p=u.mallocInt32(d),m=u.mallocInt32(d),_=u.mallocInt32(d),g=u.mallocInt32(d),v=u.mallocInt32(d),y=u.mallocInt32(d),b=u.mallocDouble(8*d)},{"./sort":38,"bit-twiddle":32,"typedarray-pool":285}],40:[function(){},{}],41:[function(e,t,r){(function(t){"use strict";function n(){try{var e=new Uint8Array(1);return e.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===e.foo()&&"function"==typeof e.subarray&&0===e.subarray(1,1).byteLength}catch(t){return!1}}function i(){return o.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function a(e,t){if(i()<t)throw new RangeError("Invalid typed array length");return o.TYPED_ARRAY_SUPPORT?(e=new Uint8Array(t),e.__proto__=o.prototype):(null===e&&(e=new o(t)),e.length=t),e}function o(e,t,r){if(!(o.TYPED_ARRAY_SUPPORT||this instanceof o))return new o(e,t,r);if("number"==typeof e){if("string"==typeof t)throw new Error("If encoding is specified then the first argument must be a string");return c(this,e)}return s(this,e,t,r)}function s(e,t,r,n){if("number"==typeof t)throw new TypeError('"value" argument must not be a number');return"undefined"!=typeof ArrayBuffer&&t instanceof ArrayBuffer?d(e,t,r,n):"string"==typeof t?f(e,t,r):p(e,t)}function l(e){if("number"!=typeof e)throw new TypeError('"size" argument must be a number');if(0>e)throw new RangeError('"size" argument must not be negative')}function u(e,t,r,n){return l(t),0>=t?a(e,t):void 0!==r?"string"==typeof n?a(e,t).fill(r,n):a(e,t).fill(r):a(e,t)}function c(e,t){if(l(t),e=a(e,0>t?0:0|m(t)),!o.TYPED_ARRAY_SUPPORT)for(var r=0;t>r;++r)e[r]=0;return e}function f(e,t,r){if(("string"!=typeof r||""===r)&&(r="utf8"),!o.isEncoding(r))throw new TypeError('"encoding" must be a valid string encoding');var n=0|g(t,r);e=a(e,n);var i=e.write(t,r);return i!==n&&(e=e.slice(0,i)),e}function h(e,t){var r=t.length<0?0:0|m(t.length);e=a(e,r);for(var n=0;r>n;n+=1)e[n]=255&t[n];return e}function d(e,t,r,n){if(t.byteLength,0>r||t.byteLength<r)throw new RangeError("'offset' is out of bounds");if(t.byteLength<r+(n||0))throw new RangeError("'length' is out of bounds");return t=void 0===r&&void 0===n?new Uint8Array(t):void 0===n?new Uint8Array(t,r):new Uint8Array(t,r,n),o.TYPED_ARRAY_SUPPORT?(e=t,e.__proto__=o.prototype):e=h(e,t),e}function p(e,t){if(o.isBuffer(t)){var r=0|m(t.length);return e=a(e,r),0===e.length?e:(t.copy(e,0,0,r),e)}if(t){if("undefined"!=typeof ArrayBuffer&&t.buffer instanceof ArrayBuffer||"length"in t)return"number"!=typeof t.length||J(t.length)?a(e,0):h(e,t);if("Buffer"===t.type&&Q(t.data))return h(e,t.data)}throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}function m(e){if(e>=i())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+i().toString(16)+" bytes");return 0|e}function _(e){return+e!=e&&(e=0),o.alloc(+e)}function g(e,t){if(o.isBuffer(e))return e.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(e)||e instanceof ArrayBuffer))return e.byteLength;"string"!=typeof e&&(e=""+e);var r=e.length;if(0===r)return 0;for(var n=!1;;)switch(t){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":case void 0:return q(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return X(e).length;default:if(n)return q(e).length;t=(""+t).toLowerCase(),n=!0}}function v(e,t,r){var n=!1;if((void 0===t||0>t)&&(t=0),t>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),0>=r)return"";if(r>>>=0,t>>>=0,t>=r)return"";for(e||(e="utf8");;)switch(e){case"hex":return P(this,t,r);case"utf8":case"utf-8":return j(this,t,r);case"ascii":return z(this,t,r);case"latin1":case"binary":return C(this,t,r);case"base64":return R(this,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return N(this,t,r);default:if(n)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),n=!0}}function y(e,t,r){var n=e[t];e[t]=e[r],e[r]=n}function b(e,t,r,n,i){if(0===e.length)return-1;if("string"==typeof r?(n=r,r=0):r>2147483647?r=2147483647:-2147483648>r&&(r=-2147483648),r=+r,isNaN(r)&&(r=i?0:e.length-1),0>r&&(r=e.length+r),r>=e.length){if(i)return-1;r=e.length-1}else if(0>r){if(!i)return-1;r=0}if("string"==typeof t&&(t=o.from(t,n)),o.isBuffer(t))return 0===t.length?-1:x(e,t,r,n,i);if("number"==typeof t)return t=255&t,o.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(e,t,r):Uint8Array.prototype.lastIndexOf.call(e,t,r):x(e,[t],r,n,i);throw new TypeError("val must be string, number or Buffer")}function x(e,t,r,n,i){function a(e,t){return 1===o?e[t]:e.readUInt16BE(t*o)}var o=1,s=e.length,l=t.length;if(void 0!==n&&(n=String(n).toLowerCase(),"ucs2"===n||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(e.length<2||t.length<2)return-1;o=2,s/=2,l/=2,r/=2}var u;if(i){var c=-1;for(u=r;s>u;u++)if(a(e,u)===a(t,-1===c?0:u-c)){if(-1===c&&(c=u),u-c+1===l)return c*o}else-1!==c&&(u-=u-c),c=-1}else for(r+l>s&&(r=s-l),u=r;u>=0;u--){for(var f=!0,h=0;l>h;h++)if(a(e,u+h)!==a(t,h)){f=!1;break}if(f)return u}return-1}function w(e,t,r,n){r=Number(r)||0;var i=e.length-r;n?(n=Number(n),n>i&&(n=i)):n=i;var a=t.length;if(a%2!==0)throw new TypeError("Invalid hex string");n>a/2&&(n=a/2);for(var o=0;n>o;++o){var s=parseInt(t.substr(2*o,2),16);if(isNaN(s))return o;e[r+o]=s}return o}function k(e,t,r,n){return Y(q(t,e.length-r),e,r,n)}function A(e,t,r,n){return Y(Z(t),e,r,n)}function T(e,t,r,n){return A(e,t,r,n)}function E(e,t,r,n){return Y(X(t),e,r,n)}function S(e,t,r,n){return Y(H(t,e.length-r),e,r,n)}function R(e,t,r){return K.fromByteArray(0===t&&r===e.length?e:e.slice(t,r))}function j(e,t,r){r=Math.min(e.length,r);for(var n=[],i=t;r>i;){var a=e[i],o=null,s=a>239?4:a>223?3:a>191?2:1;if(r>=i+s){var l,u,c,f;switch(s){case 1:128>a&&(o=a);break;case 2:l=e[i+1],128===(192&l)&&(f=(31&a)<<6|63&l,f>127&&(o=f));break;case 3:l=e[i+1],u=e[i+2],128===(192&l)&&128===(192&u)&&(f=(15&a)<<12|(63&l)<<6|63&u,f>2047&&(55296>f||f>57343)&&(o=f));break;case 4:l=e[i+1],u=e[i+2],c=e[i+3],128===(192&l)&&128===(192&u)&&128===(192&c)&&(f=(15&a)<<18|(63&l)<<12|(63&u)<<6|63&c,f>65535&&1114112>f&&(o=f))}}null===o?(o=65533,s=1):o>65535&&(o-=65536,n.push(o>>>10&1023|55296),o=56320|1023&o),n.push(o),i+=s}return M(n)}function M(e){var t=e.length;if(et>=t)return String.fromCharCode.apply(String,e);for(var r="",n=0;t>n;)r+=String.fromCharCode.apply(String,e.slice(n,n+=et));return r}function z(e,t,r){var n="";r=Math.min(e.length,r);for(var i=t;r>i;++i)n+=String.fromCharCode(127&e[i]);return n}function C(e,t,r){var n="";r=Math.min(e.length,r);for(var i=t;r>i;++i)n+=String.fromCharCode(e[i]);return n}function P(e,t,r){var n=e.length;(!t||0>t)&&(t=0),(!r||0>r||r>n)&&(r=n);for(var i="",a=t;r>a;++a)i+=W(e[a]);return i}function N(e,t,r){for(var n=e.slice(t,r),i="",a=0;a<n.length;a+=2)i+=String.fromCharCode(n[a]+256*n[a+1]);return i}function L(e,t,r){if(e%1!==0||0>e)throw new RangeError("offset is not uint");if(e+t>r)throw new RangeError("Trying to access beyond buffer length")}function O(e,t,r,n,i,a){if(!o.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>i||a>t)throw new RangeError('"value" argument is out of bounds');if(r+n>e.length)throw new RangeError("Index out of range")}function I(e,t,r,n){0>t&&(t=65535+t+1);for(var i=0,a=Math.min(e.length-r,2);a>i;++i)e[r+i]=(t&255<<8*(n?i:1-i))>>>8*(n?i:1-i)}function F(e,t,r,n){0>t&&(t=4294967295+t+1);for(var i=0,a=Math.min(e.length-r,4);a>i;++i)e[r+i]=t>>>8*(n?i:3-i)&255}function U(e,t,r,n){if(r+n>e.length)throw new RangeError("Index out of range");if(0>r)throw new RangeError("Index out of range")}function D(e,t,r,n,i){return i||U(e,t,r,4,3.4028234663852886e38,-3.4028234663852886e38),$.write(e,t,r,n,23,4),r+4}function B(e,t,r,n,i){return i||U(e,t,r,8,1.7976931348623157e308,-1.7976931348623157e308),$.write(e,t,r,n,52,8),r+8}function G(e){if(e=V(e).replace(tt,""),e.length<2)return""; 2 for(;e.length%4!==0;)e+="=";return e}function V(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")}function W(e){return 16>e?"0"+e.toString(16):e.toString(16)}function q(e,t){t=t||1/0;for(var r,n=e.length,i=null,a=[],o=0;n>o;++o){if(r=e.charCodeAt(o),r>55295&&57344>r){if(!i){if(r>56319){(t-=3)>-1&&a.push(239,191,189);continue}if(o+1===n){(t-=3)>-1&&a.push(239,191,189);continue}i=r;continue}if(56320>r){(t-=3)>-1&&a.push(239,191,189),i=r;continue}r=(i-55296<<10|r-56320)+65536}else i&&(t-=3)>-1&&a.push(239,191,189);if(i=null,128>r){if((t-=1)<0)break;a.push(r)}else if(2048>r){if((t-=2)<0)break;a.push(r>>6|192,63&r|128)}else if(65536>r){if((t-=3)<0)break;a.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(1114112>r))throw new Error("Invalid code point");if((t-=4)<0)break;a.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return a}function Z(e){for(var t=[],r=0;r<e.length;++r)t.push(255&e.charCodeAt(r));return t}function H(e,t){for(var r,n,i,a=[],o=0;o<e.length&&!((t-=2)<0);++o)r=e.charCodeAt(o),n=r>>8,i=r%256,a.push(i),a.push(n);return a}function X(e){return K.toByteArray(G(e))}function Y(e,t,r,n){for(var i=0;n>i&&!(i+r>=t.length||i>=e.length);++i)t[i+r]=e[i];return i}function J(e){return e!==e}var K=e("base64-js"),$=e("ieee754"),Q=e("isarray");r.Buffer=o,r.SlowBuffer=_,r.INSPECT_MAX_BYTES=50,o.TYPED_ARRAY_SUPPORT=void 0!==t.TYPED_ARRAY_SUPPORT?t.TYPED_ARRAY_SUPPORT:n(),r.kMaxLength=i(),o.poolSize=8192,o._augment=function(e){return e.__proto__=o.prototype,e},o.from=function(e,t,r){return s(null,e,t,r)},o.TYPED_ARRAY_SUPPORT&&(o.prototype.__proto__=Uint8Array.prototype,o.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&o[Symbol.species]===o&&Object.defineProperty(o,Symbol.species,{value:null,configurable:!0})),o.alloc=function(e,t,r){return u(null,e,t,r)},o.allocUnsafe=function(e){return c(null,e)},o.allocUnsafeSlow=function(e){return c(null,e)},o.isBuffer=function(e){return!(null==e||!e._isBuffer)},o.compare=function(e,t){if(!o.isBuffer(e)||!o.isBuffer(t))throw new TypeError("Arguments must be Buffers");if(e===t)return 0;for(var r=e.length,n=t.length,i=0,a=Math.min(r,n);a>i;++i)if(e[i]!==t[i]){r=e[i],n=t[i];break}return n>r?-1:r>n?1:0},o.isEncoding=function(e){switch(String(e).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},o.concat=function(e,t){if(!Q(e))throw new TypeError('"list" argument must be an Array of Buffers');if(0===e.length)return o.alloc(0);var r;if(void 0===t)for(t=0,r=0;r<e.length;++r)t+=e[r].length;var n=o.allocUnsafe(t),i=0;for(r=0;r<e.length;++r){var a=e[r];if(!o.isBuffer(a))throw new TypeError('"list" argument must be an Array of Buffers');a.copy(n,i),i+=a.length}return n},o.byteLength=g,o.prototype._isBuffer=!0,o.prototype.swap16=function(){var e=this.length;if(e%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var t=0;e>t;t+=2)y(this,t,t+1);return this},o.prototype.swap32=function(){var e=this.length;if(e%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var t=0;e>t;t+=4)y(this,t,t+3),y(this,t+1,t+2);return this},o.prototype.swap64=function(){var e=this.length;if(e%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var t=0;e>t;t+=8)y(this,t,t+7),y(this,t+1,t+6),y(this,t+2,t+5),y(this,t+3,t+4);return this},o.prototype.toString=function(){var e=0|this.length;return 0===e?"":0===arguments.length?j(this,0,e):v.apply(this,arguments)},o.prototype.equals=function(e){if(!o.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e?!0:0===o.compare(this,e)},o.prototype.inspect=function(){var e="",t=r.INSPECT_MAX_BYTES;return this.length>0&&(e=this.toString("hex",0,t).match(/.{2}/g).join(" "),this.length>t&&(e+=" ... ")),"<Buffer "+e+">"},o.prototype.compare=function(e,t,r,n,i){if(!o.isBuffer(e))throw new TypeError("Argument must be a Buffer");if(void 0===t&&(t=0),void 0===r&&(r=e?e.length:0),void 0===n&&(n=0),void 0===i&&(i=this.length),0>t||r>e.length||0>n||i>this.length)throw new RangeError("out of range index");if(n>=i&&t>=r)return 0;if(n>=i)return-1;if(t>=r)return 1;if(t>>>=0,r>>>=0,n>>>=0,i>>>=0,this===e)return 0;for(var a=i-n,s=r-t,l=Math.min(a,s),u=this.slice(n,i),c=e.slice(t,r),f=0;l>f;++f)if(u[f]!==c[f]){a=u[f],s=c[f];break}return s>a?-1:a>s?1:0},o.prototype.includes=function(e,t,r){return-1!==this.indexOf(e,t,r)},o.prototype.indexOf=function(e,t,r){return b(this,e,t,r,!0)},o.prototype.lastIndexOf=function(e,t,r){return b(this,e,t,r,!1)},o.prototype.write=function(e,t,r,n){if(void 0===t)n="utf8",r=this.length,t=0;else if(void 0===r&&"string"==typeof t)n=t,r=this.length,t=0;else{if(!isFinite(t))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");t=0|t,isFinite(r)?(r=0|r,void 0===n&&(n="utf8")):(n=r,r=void 0)}var i=this.length-t;if((void 0===r||r>i)&&(r=i),e.length>0&&(0>r||0>t)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var a=!1;;)switch(n){case"hex":return w(this,e,t,r);case"utf8":case"utf-8":return k(this,e,t,r);case"ascii":return A(this,e,t,r);case"latin1":case"binary":return T(this,e,t,r);case"base64":return E(this,e,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return S(this,e,t,r);default:if(a)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),a=!0}},o.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var et=4096;o.prototype.slice=function(e,t){var r=this.length;e=~~e,t=void 0===t?r:~~t,0>e?(e+=r,0>e&&(e=0)):e>r&&(e=r),0>t?(t+=r,0>t&&(t=0)):t>r&&(t=r),e>t&&(t=e);var n;if(o.TYPED_ARRAY_SUPPORT)n=this.subarray(e,t),n.__proto__=o.prototype;else{var i=t-e;n=new o(i,void 0);for(var a=0;i>a;++a)n[a]=this[a+e]}return n},o.prototype.readUIntLE=function(e,t,r){e=0|e,t=0|t,r||L(e,t,this.length);for(var n=this[e],i=1,a=0;++a<t&&(i*=256);)n+=this[e+a]*i;return n},o.prototype.readUIntBE=function(e,t,r){e=0|e,t=0|t,r||L(e,t,this.length);for(var n=this[e+--t],i=1;t>0&&(i*=256);)n+=this[e+--t]*i;return n},o.prototype.readUInt8=function(e,t){return t||L(e,1,this.length),this[e]},o.prototype.readUInt16LE=function(e,t){return t||L(e,2,this.length),this[e]|this[e+1]<<8},o.prototype.readUInt16BE=function(e,t){return t||L(e,2,this.length),this[e]<<8|this[e+1]},o.prototype.readUInt32LE=function(e,t){return t||L(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},o.prototype.readUInt32BE=function(e,t){return t||L(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},o.prototype.readIntLE=function(e,t,r){e=0|e,t=0|t,r||L(e,t,this.length);for(var n=this[e],i=1,a=0;++a<t&&(i*=256);)n+=this[e+a]*i;return i*=128,n>=i&&(n-=Math.pow(2,8*t)),n},o.prototype.readIntBE=function(e,t,r){e=0|e,t=0|t,r||L(e,t,this.length);for(var n=t,i=1,a=this[e+--n];n>0&&(i*=256);)a+=this[e+--n]*i;return i*=128,a>=i&&(a-=Math.pow(2,8*t)),a},o.prototype.readInt8=function(e,t){return t||L(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},o.prototype.readInt16LE=function(e,t){t||L(e,2,this.length);var r=this[e]|this[e+1]<<8;return 32768&r?4294901760|r:r},o.prototype.readInt16BE=function(e,t){t||L(e,2,this.length);var r=this[e+1]|this[e]<<8;return 32768&r?4294901760|r:r},o.prototype.readInt32LE=function(e,t){return t||L(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},o.prototype.readInt32BE=function(e,t){return t||L(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},o.prototype.readFloatLE=function(e,t){return t||L(e,4,this.length),$.read(this,e,!0,23,4)},o.prototype.readFloatBE=function(e,t){return t||L(e,4,this.length),$.read(this,e,!1,23,4)},o.prototype.readDoubleLE=function(e,t){return t||L(e,8,this.length),$.read(this,e,!0,52,8)},o.prototype.readDoubleBE=function(e,t){return t||L(e,8,this.length),$.read(this,e,!1,52,8)},o.prototype.writeUIntLE=function(e,t,r,n){if(e=+e,t=0|t,r=0|r,!n){var i=Math.pow(2,8*r)-1;O(this,e,t,r,i,0)}var a=1,o=0;for(this[t]=255&e;++o<r&&(a*=256);)this[t+o]=e/a&255;return t+r},o.prototype.writeUIntBE=function(e,t,r,n){if(e=+e,t=0|t,r=0|r,!n){var i=Math.pow(2,8*r)-1;O(this,e,t,r,i,0)}var a=r-1,o=1;for(this[t+a]=255&e;--a>=0&&(o*=256);)this[t+a]=e/o&255;return t+r},o.prototype.writeUInt8=function(e,t,r){return e=+e,t=0|t,r||O(this,e,t,1,255,0),o.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[t]=255&e,t+1},o.prototype.writeUInt16LE=function(e,t,r){return e=+e,t=0|t,r||O(this,e,t,2,65535,0),o.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):I(this,e,t,!0),t+2},o.prototype.writeUInt16BE=function(e,t,r){return e=+e,t=0|t,r||O(this,e,t,2,65535,0),o.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):I(this,e,t,!1),t+2},o.prototype.writeUInt32LE=function(e,t,r){return e=+e,t=0|t,r||O(this,e,t,4,4294967295,0),o.TYPED_ARRAY_SUPPORT?(this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e):F(this,e,t,!0),t+4},o.prototype.writeUInt32BE=function(e,t,r){return e=+e,t=0|t,r||O(this,e,t,4,4294967295,0),o.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):F(this,e,t,!1),t+4},o.prototype.writeIntLE=function(e,t,r,n){if(e=+e,t=0|t,!n){var i=Math.pow(2,8*r-1);O(this,e,t,r,i-1,-i)}var a=0,o=1,s=0;for(this[t]=255&e;++a<r&&(o*=256);)0>e&&0===s&&0!==this[t+a-1]&&(s=1),this[t+a]=(e/o>>0)-s&255;return t+r},o.prototype.writeIntBE=function(e,t,r,n){if(e=+e,t=0|t,!n){var i=Math.pow(2,8*r-1);O(this,e,t,r,i-1,-i)}var a=r-1,o=1,s=0;for(this[t+a]=255&e;--a>=0&&(o*=256);)0>e&&0===s&&0!==this[t+a+1]&&(s=1),this[t+a]=(e/o>>0)-s&255;return t+r},o.prototype.writeInt8=function(e,t,r){return e=+e,t=0|t,r||O(this,e,t,1,127,-128),o.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),0>e&&(e=255+e+1),this[t]=255&e,t+1},o.prototype.writeInt16LE=function(e,t,r){return e=+e,t=0|t,r||O(this,e,t,2,32767,-32768),o.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):I(this,e,t,!0),t+2},o.prototype.writeInt16BE=function(e,t,r){return e=+e,t=0|t,r||O(this,e,t,2,32767,-32768),o.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):I(this,e,t,!1),t+2},o.prototype.writeInt32LE=function(e,t,r){return e=+e,t=0|t,r||O(this,e,t,4,2147483647,-2147483648),o.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24):F(this,e,t,!0),t+4},o.prototype.writeInt32BE=function(e,t,r){return e=+e,t=0|t,r||O(this,e,t,4,2147483647,-2147483648),0>e&&(e=4294967295+e+1),o.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):F(this,e,t,!1),t+4},o.prototype.writeFloatLE=function(e,t,r){return D(this,e,t,!0,r)},o.prototype.writeFloatBE=function(e,t,r){return D(this,e,t,!1,r)},o.prototype.writeDoubleLE=function(e,t,r){return B(this,e,t,!0,r)},o.prototype.writeDoubleBE=function(e,t,r){return B(this,e,t,!1,r)},o.prototype.copy=function(e,t,r,n){if(r||(r=0),n||0===n||(n=this.length),t>=e.length&&(t=e.length),t||(t=0),n>0&&r>n&&(n=r),n===r)return 0;if(0===e.length||0===this.length)return 0;if(0>t)throw new RangeError("targetStart out of bounds");if(0>r||r>=this.length)throw new RangeError("sourceStart out of bounds");if(0>n)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),e.length-t<n-r&&(n=e.length-t+r);var i,a=n-r;if(this===e&&t>r&&n>t)for(i=a-1;i>=0;--i)e[i+t]=this[i+r];else if(1e3>a||!o.TYPED_ARRAY_SUPPORT)for(i=0;a>i;++i)e[i+t]=this[i+r];else Uint8Array.prototype.set.call(e,this.subarray(r,r+a),t);return a},o.prototype.fill=function(e,t,r,n){if("string"==typeof e){if("string"==typeof t?(n=t,t=0,r=this.length):"string"==typeof r&&(n=r,r=this.length),1===e.length){var i=e.charCodeAt(0);256>i&&(e=i)}if(void 0!==n&&"string"!=typeof n)throw new TypeError("encoding must be a string");if("string"==typeof n&&!o.isEncoding(n))throw new TypeError("Unknown encoding: "+n)}else"number"==typeof e&&(e=255&e);if(0>t||this.length<t||this.length<r)throw new RangeError("Out of range index");if(t>=r)return this;t>>>=0,r=void 0===r?this.length:r>>>0,e||(e=0);var a;if("number"==typeof e)for(a=t;r>a;++a)this[a]=e;else{var s=o.isBuffer(e)?e:q(new o(e,n).toString()),l=s.length;for(a=0;r-t>a;++a)this[a+t]=s[a%l]}return this};var tt=/[^+\/0-9A-Za-z-_]/g}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"base64-js":31,ieee754:186,isarray:189}],42:[function(e,t){e("../../modules/es6.string.iterator"),e("../../modules/es6.array.from"),t.exports=e("../../modules/_core").Array.from},{"../../modules/_core":74,"../../modules/es6.array.from":142,"../../modules/es6.string.iterator":157}],43:[function(e,t){e("../modules/web.dom.iterable"),e("../modules/es6.string.iterator"),t.exports=e("../modules/core.get-iterator")},{"../modules/core.get-iterator":140,"../modules/es6.string.iterator":157,"../modules/web.dom.iterable":163}],44:[function(e,t){e("../modules/web.dom.iterable"),e("../modules/es6.string.iterator"),t.exports=e("../modules/core.is-iterable")},{"../modules/core.is-iterable":141,"../modules/es6.string.iterator":157,"../modules/web.dom.iterable":163}],45:[function(e,t){var r=e("../../modules/_core"),n=r.JSON||(r.JSON={stringify:JSON.stringify});t.exports=function(){return n.stringify.apply(n,arguments)}},{"../../modules/_core":74}],46:[function(e,t){e("../modules/es6.object.to-string"),e("../modules/es6.string.iterator"),e("../modules/web.dom.iterable"),e("../modules/es6.map"),e("../modules/es7.map.to-json"),t.exports=e("../modules/_core").Map},{"../modules/_core":74,"../modules/es6.map":144,"../modules/es6.object.to-string":154,"../modules/es6.string.iterator":157,"../modules/es7.map.to-json":159,"../modules/web.dom.iterable":163}],47:[function(e,t){e("../../modules/es6.math.log2"),t.exports=e("../../modules/_core").Math.log2},{"../../modules/_core":74,"../../modules/es6.math.log2":145}],48:[function(e,t){e("../../modules/es6.object.assign"),t.exports=e("../../modules/_core").Object.assign},{"../../modules/_core":74,"../../modules/es6.object.assign":146}],49:[function(e,t){e("../../modules/es6.object.create");var r=e("../../modules/_core").Object;t.exports=function(e,t){return r.create(e,t)}},{"../../modules/_core":74,"../../modules/es6.object.create":147}],50:[function(e,t){e("../../modules/es6.object.define-property");var r=e("../../modules/_core").Object;t.exports=function(e,t,n){return r.defineProperty(e,t,n)}},{"../../modules/_core":74,"../../modules/es6.object.define-property":148}],51:[function(e,t){e("../../modules/es6.object.freeze"),t.exports=e("../../modules/_core").Object.freeze},{"../../modules/_core":74,"../../modules/es6.object.freeze":149}],52:[function(e,t){e("../../modules/es6.object.get-own-property-descriptor");var r=e("../../modules/_core").Object;t.exports=function(e,t){return r.getOwnPropertyDescriptor(e,t)}},{"../../modules/_core":74,"../../modules/es6.object.get-own-property-descriptor":150}],53:[function(e,t){e("../../modules/es6.object.get-prototype-of"),t.exports=e("../../modules/_core").Object.getPrototypeOf},{"../../modules/_core":74,"../../modules/es6.object.get-prototype-of":151}],54:[function(e,t){e("../../modules/es6.object.keys"),t.exports=e("../../modules/_core").Object.keys},{"../../modules/_core":74,"../../modules/es6.object.keys":152}],55:[function(e,t){e("../../modules/es6.object.set-prototype-of"),t.exports=e("../../modules/_core").Object.setPrototypeOf},{"../../modules/_core":74,"../../modules/es6.object.set-prototype-of":153}],56:[function(e,t){e("../modules/es6.object.to-string"),e("../modules/es6.string.iterator"),e("../modules/web.dom.iterable"),e("../modules/es6.promise"),t.exports=e("../modules/_core").Promise},{"../modules/_core":74,"../modules/es6.object.to-string":154,"../modules/es6.promise":155,"../modules/es6.string.iterator":157,"../modules/web.dom.iterable":163}],57:[function(e,t){e("../modules/es6.object.to-string"),e("../modules/es6.string.iterator"),e("../modules/web.dom.iterable"),e("../modules/es6.set"),e("../modules/es7.set.to-json"),t.exports=e("../modules/_core").Set},{"../modules/_core":74,"../modules/es6.object.to-string":154,"../modules/es6.set":156,"../modules/es6.string.iterator":157,"../modules/es7.set.to-json":160,"../modules/web.dom.iterable":163}],58:[function(e,t){e("../../modules/es6.symbol"),e("../../modules/es6.object.to-string"),e("../../modules/es7.symbol.async-iterator"),e("../../modules/es7.symbol.observable"),t.exports=e("../../modules/_core").Symbol},{"../../modules/_core":74,"../../modules/es6.object.to-string":154,"../../modules/es6.symbol":158,"../../modules/es7.symbol.async-iterator":161,"../../modules/es7.symbol.observable":162}],59:[function(e,t){e("../../modules/es6.string.iterator"),e("../../modules/web.dom.iterable"),t.exports=e("../../modules/_wks-ext").f("iterator")},{"../../modules/_wks-ext":137,"../../modules/es6.string.iterator":157,"../../modules/web.dom.iterable":163}],60:[function(e,t){t.exports=function(e){if("function"!=typeof e)throw TypeError(e+" is not a function!");return e}},{}],61:[function(e,t){t.exports=function(){}},{}],62:[function(e,t){t.exports=function(e,t,r,n){if(!(e instanceof t)||void 0!==n&&n in e)throw TypeError(r+": incorrect invocation!");return e}},{}],63:[function(e,t){var r=e("./_is-object");t.exports=function(e){if(!r(e))throw TypeError(e+" is not an object!");return e}},{"./_is-object":94}],64:[function(e,t){var r=e("./_for-of");t.exports=function(e,t){var n=[];return r(e,!1,n.push,n,t),n}},{"./_for-of":84}],65:[function(e,t){var r=e("./_to-iobject"),n=e("./_to-length"),i=e("./_to-index");t.exports=function(e){return function(t,a,o){var s,l=r(t),u=n(l.length),c=i(o,u);if(e&&a!=a){for(;u>c;)if(s=l[c++],s!=s)return!0}else for(;u>c;c++)if((e||c in l)&&l[c]===a)return e||c||0;return!e&&-1}}},{"./_to-index":129,"./_to-iobject":131,"./_to-length":132}],66:[function(e,t){var r=e("./_ctx"),n=e("./_iobject"),i=e("./_to-object"),a=e("./_to-length"),o=e("./_array-species-create");t.exports=function(e,t){var s=1==e,l=2==e,u=3==e,c=4==e,f=6==e,h=5==e||f,d=t||o;return function(t,o,p){for(var m,_,g=i(t),v=n(g),y=r(o,p,3),b=a(v.length),x=0,w=s?d(t,b):l?d(t,0):void 0;b>x;x++)if((h||x in v)&&(m=v[x],_=y(m,x,g),e))if(s)w[x]=_;else if(_)switch(e){case 3:return!0;case 5:return m;case 6:return x;case 2:w.push(m)}else if(c)return!1;return f?-1:u||c?c:w}}},{"./_array-species-create":68,"./_ctx":76,"./_iobject":91,"./_to-length":132,"./_to-object":133}],67:[function(e,t){var r=e("./_is-object"),n=e("./_is-array"),i=e("./_wks")("species");t.exports=function(e){var t;return n(e)&&(t=e.constructor,"function"!=typeof t||t!==Array&&!n(t.prototype)||(t=void 0),r(t)&&(t=t[i],null===t&&(t=void 0))),void 0===t?Array:t}},{"./_is-array":93,"./_is-object":94,"./_wks":138}],68:[function(e,t){var r=e("./_array-species-constructor");t.exports=function(e,t){return new(r(e))(t)}},{"./_array-species-constructor":67}],69:[function(e,t){var r=e("./_cof"),n=e("./_wks")("toStringTag"),i="Arguments"==r(function(){return arguments}()),a=function(e,t){try{return e[t]}catch(r){}};t.exports=function(e){var t,o,s;return void 0===e?"Undefined":null===e?"Null":"string"==typeof(o=a(t=Object(e),n))?o:i?r(t):"Object"==(s=r(t))&&"function"==typeof t.callee?"Arguments":s}},{"./_cof":70,"./_wks":138}],70:[function(e,t){var r={}.toString;t.exports=function(e){return r.call(e).slice(8,-1)}},{}],71:[function(e,t){"use strict";var r=e("./_object-dp").f,n=e("./_object-create"),i=e("./_redefine-all"),a=e("./_ctx"),o=e("./_an-instance"),s=e("./_defined"),l=e("./_for-of"),u=e("./_iter-define"),c=e("./_iter-step"),f=e("./_set-species"),h=e("./_descriptors"),d=e("./_meta").fastKey,p=h?"_s":"size",m=function(e,t){var r,n=d(t);if("F"!==n)return e._i[n];for(r=e._f;r;r=r.n)if(r.k==t)return r};t.exports={getConstructor:function(e,t,u,c){var f=e(function(e,r){o(e,f,t,"_i"),e._i=n(null),e._f=void 0,e._l=void 0,e[p]=0,void 0!=r&&l(r,u,e[c],e)});return i(f.prototype,{clear:function(){for(var e=this,t=e._i,r=e._f;r;r=r.n)r.r=!0,r.p&&(r.p=r.p.n=void 0),delete t[r.i];e._f=e._l=void 0,e[p]=0},"delete":function(e){var t=this,r=m(t,e);if(r){var n=r.n,i=r.p;delete t._i[r.i],r.r=!0,i&&(i.n=n),n&&(n.p=i),t._f==r&&(t._f=n),t._l==r&&(t._l=i),t[p]--}return!!r},forEach:function(e){o(this,f,"forEach");for(var t,r=a(e,arguments.length>1?arguments[1]:void 0,3);t=t?t.n:this._f;)for(r(t.v,t.k,this);t&&t.r;)t=t.p},has:function(e){return!!m(this,e)}}),h&&r(f.prototype,"size",{get:function(){return s(this[p])}}),f},def:function(e,t,r){var n,i,a=m(e,t);return a?a.v=r:(e._l=a={i:i=d(t,!0),k:t,v:r,p:n=e._l,n:void 0,r:!1},e._f||(e._f=a),n&&(n.n=a),e[p]++,"F"!==i&&(e._i[i]=a)),e},getEntry:m,setStrong:function(e,t,r){u(e,t,function(e,t){this._t=e,this._k=t,this._l=void 0},function(){for(var e=this,t=e._k,r=e._l;r&&r.r;)r=r.p;return e._t&&(e._l=r=r?r.n:e._t._f)?"keys"==t?c(0,r.k):"values"==t?c(0,r.v):c(0,[r.k,r.v]):(e._t=void 0,c(1))},r?"entries":"values",!r,!0),f(t)}}},{"./_an-instance":62,"./_ctx":76,"./_defined":77,"./_descriptors":78,"./_for-of":84,"./_iter-define":97,"./_iter-step":99,"./_meta":103,"./_object-create":106,"./_object-dp":107,"./_redefine-all":119,"./_set-species":122}],72:[function(e,t){var r=e("./_classof"),n=e("./_array-from-iterable");t.exports=function(e){return function(){if(r(this)!=e)throw TypeError(e+"#toJSON isn't generic");return n(this)}}},{"./_array-from-iterable":64,"./_classof":69}],73:[function(e,t){"use strict";var r=e("./_global"),n=e("./_export"),i=e("./_meta"),a=e("./_fails"),o=e("./_hide"),s=e("./_redefine-all"),l=e("./_for-of"),u=e("./_an-instance"),c=e("./_is-object"),f=e("./_set-to-string-tag"),h=e("./_object-dp").f,d=e("./_array-methods")(0),p=e("./_descriptors");t.exports=function(e,t,m,_,g,v){var y=r[e],b=y,x=g?"set":"add",w=b&&b.prototype,k={};return p&&"function"==typeof b&&(v||w.forEach&&!a(function(){(new b).entries().next()}))?(b=t(function(t,r){u(t,b,e,"_c"),t._c=new y,void 0!=r&&l(r,g,t[x],t)}),d("add,clear,delete,forEach,get,has,set,keys,values,entries,toJSON".split(","),function(e){var t="add"==e||"set"==e;e in w&&(!v||"clear"!=e)&&o(b.prototype,e,function(r,n){if(u(this,b,e),!t&&v&&!c(r))return"get"==e?void 0:!1;var i=this._c[e](0===r?0:r,n);return t?this:i})}),"size"in w&&h(b.prototype,"size",{get:function(){return this._c.size}})):(b=_.getConstructor(t,e,g,x),s(b.prototype,m),i.NEED=!0),f(b,e),k[e]=b,n(n.G+n.W+n.F,k),v||_.setStrong(b,e,g),b}},{"./_an-instance":62,"./_array-methods":66,"./_descriptors":78,"./_export":82,"./_fails":83,"./_for-of":84,"./_global":85,"./_hide":87,"./_is-object":94,"./_meta":103,"./_object-dp":107,"./_redefine-all":119,"./_set-to-string-tag":123}],74:[function(e,t){var r=t.exports={version:"2.4.0"};"number"==typeof __e&&(__e=r)},{}],75:[function(e,t){"use strict";var r=e("./_object-dp"),n=e("./_property-desc");t.exports=function(e,t,i){t in e?r.f(e,t,n(0,i)):e[t]=i}},{"./_object-dp":107,"./_property-desc":118}],76:[function(e,t){var r=e("./_a-function");t.exports=function(e,t,n){if(r(e),void 0===t)return e;switch(n){case 1:return function(r){return e.call(t,r)};case 2:return function(r,n){return e.call(t,r,n)};case 3:return function(r,n,i){return e.call(t,r,n,i)}}return function(){return e.apply(t,arguments)}}},{"./_a-function":60}],77:[function(e,t){t.exports=function(e){if(void 0==e)throw TypeError("Can't call method on "+e);return e}},{}],78:[function(e,t){t.exports=!e("./_fails")(function(){return 7!=Object.defineProperty({},"a",{get:function(){return 7}}).a})},{"./_fails":83}],79:[function(e,t){var r=e("./_is-object"),n=e("./_global").document,i=r(n)&&r(n.createElement);t.exports=function(e){return i?n.createElement(e):{}}},{"./_global":85,"./_is-object":94}],80:[function(e,t){t.exports="constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf".split(",")},{}],81:[function(e,t){var r=e("./_object-keys"),n=e("./_object-gops"),i=e("./_object-pie");t.exports=function(e){var t=r(e),a=n.f;if(a)for(var o,s=a(e),l=i.f,u=0;s.length>u;)l.call(e,o=s[u++])&&t.push(o);return t}},{"./_object-gops":112,"./_object-keys":115,"./_object-pie":116}],82:[function(e,t){var r=e("./_global"),n=e("./_core"),i=e("./_ctx"),a=e("./_hide"),o="prototype",s=function(e,t,l){var u,c,f,h=e&s.F,d=e&s.G,p=e&s.S,m=e&s.P,_=e&s.B,g=e&s.W,v=d?n:n[t]||(n[t]={}),y=v[o],b=d?r:p?r[t]:(r[t]||{})[o];d&&(l=t);for(u in l)c=!h&&b&&void 0!==b[u],c&&u in v||(f=c?b[u]:l[u],v[u]=d&&"function"!=typeof b[u]?l[u]:_&&c?i(f,r):g&&b[u]==f?function(e){var t=function(t,r,n){if(this instanceof e){switch(arguments.length){case 0:return new e;case 1:return new e(t);case 2:return new e(t,r)}return new e(t,r,n)}return e.apply(this,arguments)};return t[o]=e[o],t}(f):m&&"function"==typeof f?i(Function.call,f):f,m&&((v.virtual||(v.virtual={}))[u]=f,e&s.R&&y&&!y[u]&&a(y,u,f)))};s.F=1,s.G=2,s.S=4,s.P=8,s.B=16,s.W=32,s.U=64,s.R=128,t.exports=s},{"./_core":74,"./_ctx":76,"./_global":85,"./_hide":87}],83:[function(e,t){t.exports=function(e){try{return!!e()}catch(t){return!0}}},{}],84:[function(e,t,r){var n=e("./_ctx"),i=e("./_iter-call"),a=e("./_is-array-iter"),o=e("./_an-object"),s=e("./_to-length"),l=e("./core.get-iterator-method"),u={},c={},r=t.exports=function(e,t,r,f,h){var d,p,m,_,g=h?function(){return e}:l(e),v=n(r,f,t?2:1),y=0;if("function"!=typeof g)throw TypeError(e+" is not iterable!");if(a(g)){for(d=s(e.length);d>y;y++)if(_=t?v(o(p=e[y])[0],p[1]):v(e[y]),_===u||_===c)return _}else for(m=g.call(e);!(p=m.next()).done;)if(_=i(m,v,p.value,t),_===u||_===c)return _};r.BREAK=u,r.RETURN=c},{"./_an-object":63,"./_ctx":76,"./_is-array-iter":92,"./_iter-call":95,"./_to-length":132,"./core.get-iterator-method":139}],85:[function(e,t){var r=t.exports="undefined"!=typeof window&&window.Math==Math?window:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")();"number"==typeof __g&&(__g=r)},{}],86:[function(e,t){var r={}.hasOwnProperty;t.exports=function(e,t){return r.call(e,t)}},{}],87:[function(e,t){var r=e("./_object-dp"),n=e("./_property-desc");t.exports=e("./_descriptors")?function(e,t,i){return r.f(e,t,n(1,i))}:function(e,t,r){return e[t]=r,e}},{"./_descriptors":78,"./_object-dp":107,"./_property-desc":118}],88:[function(e,t){t.exports=e("./_global").document&&document.documentElement},{"./_global":85}],89:[function(e,t){t.exports=!e("./_descriptors")&&!e("./_fails")(function(){return 7!=Object.defineProperty(e("./_dom-create")("div"),"a",{get:function(){return 7}}).a})},{"./_descriptors":78,"./_dom-create":79,"./_fails":83}],90:[function(e,t){t.exports=function(e,t,r){var n=void 0===r;switch(t.length){case 0:return n?e():e.call(r);case 1:return n?e(t[0]):e.call(r,t[0]);case 2:return n?e(t[0],t[1]):e.call(r,t[0],t[1]);case 3:return n?e(t[0],t[1],t[2]):e.call(r,t[0],t[1],t[2]);case 4:return n?e(t[0],t[1],t[2],t[3]):e.call(r,t[0],t[1],t[2],t[3])}return e.apply(r,t)}},{}],91:[function(e,t){var r=e("./_cof");t.exports=Object("z").propertyIsEnumerable(0)?Object:function(e){return"String"==r(e)?e.split(""):Object(e)}},{"./_cof":70}],92:[function(e,t){var r=e("./_iterators"),n=e("./_wks")("iterator"),i=Array.prototype;t.exports=function(e){return void 0!==e&&(r.Array===e||i[n]===e)}},{"./_iterators":100,"./_wks":138}],93:[function(e,t){var r=e("./_cof");t.exports=Array.isArray||function(e){return"Array"==r(e)}},{"./_cof":70}],94:[function(e,t){t.exports=function(e){return"object"==typeof e?null!==e:"function"==typeof e}},{}],95:[function(e,t){var r=e("./_an-object");t.exports=function(e,t,n,i){try{return i?t(r(n)[0],n[1]):t(n)}catch(a){var o=e["return"];throw void 0!==o&&r(o.call(e)),a}}},{"./_an-object":63}],96:[function(e,t){"use strict";var r=e("./_object-create"),n=e("./_property-desc"),i=e("./_set-to-string-tag"),a={};e("./_hide")(a,e("./_wks")("iterator"),function(){return this}),t.exports=function(e,t,o){e.prototype=r(a,{next:n(1,o)}),i(e,t+" Iterator")}},{"./_hide":87,"./_object-create":106,"./_property-desc":118,"./_set-to-string-tag":123,"./_wks":138}],97:[function(e,t){"use strict";var r=e("./_library"),n=e("./_export"),i=e("./_redefine"),a=e("./_hide"),o=e("./_has"),s=e("./_iterators"),l=e("./_iter-create"),u=e("./_set-to-string-tag"),c=e("./_object-gpo"),f=e("./_wks")("iterator"),h=!([].keys&&"next"in[].keys()),d="@@iterator",p="keys",m="values",_=function(){return this};t.exports=function(e,t,g,v,y,b,x){l(g,t,v);var w,k,A,T=function(e){if(!h&&e in j)return j[e];switch(e){case p:return function(){return new g(this,e)};case m:return function(){return new g(this,e)}}return function(){return new g(this,e)}},E=t+" Iterator",S=y==m,R=!1,j=e.prototype,M=j[f]||j[d]||y&&j[y],z=M||T(y),C=y?S?T("entries"):z:void 0,P="Array"==t?j.entries||M:M;if(P&&(A=c(P.call(new e)),A!==Object.prototype&&(u(A,E,!0),r||o(A,f)||a(A,f,_))),S&&M&&M.name!==m&&(R=!0,z=function(){return M.call(this)}),r&&!x||!h&&!R&&j[f]||a(j,f,z),s[t]=z,s[E]=_,y)if(w={values:S?z:T(m),keys:b?z:T(p),entries:C},x)for(k in w)k in j||i(j,k,w[k]);else n(n.P+n.F*(h||R),t,w);return w}},{"./_export":82,"./_has":86,"./_hide":87,"./_iter-create":96,"./_iterators":100,"./_library":102,"./_object-gpo":113,"./_redefine":120,"./_set-to-string-tag":123,"./_wks":138}],98:[function(e,t){var r=e("./_wks")("iterator"),n=!1;try{var i=[7][r]();i["return"]=function(){n=!0},Array.from(i,function(){throw 2})}catch(a){}t.exports=function(e,t){if(!t&&!n)return!1;var i=!1;try{var a=[7],o=a[r]();o.next=function(){return{done:i=!0}},a[r]=function(){return o},e(a)}catch(s){}return i}},{"./_wks":138}],99:[function(e,t){t.exports=function(e,t){return{value:t,done:!!e}}},{}],100:[function(e,t){t.exports={}},{}],101:[function(e,t){var r=e("./_object-keys"),n=e("./_to-iobject");t.exports=function(e,t){for(var i,a=n(e),o=r(a),s=o.length,l=0;s>l;)if(a[i=o[l++]]===t)return i}},{"./_object-keys":115,"./_to-iobject":131}],102:[function(e,t){t.exports=!0},{}],103:[function(e,t){var r=e("./_uid")("meta"),n=e("./_is-object"),i=e("./_has"),a=e("./_object-dp").f,o=0,s=Object.isExtensible||function(){return!0},l=!e("./_fails")(function(){return s(Object.preventExtensions({}))}),u=function(e){a(e,r,{value:{i:"O"+ ++o,w:{}}})},c=function(e,t){if(!n(e))return"symbol"==typeof e?e:("string"==typeof e?"S":"P")+e;if(!i(e,r)){if(!s(e))return"F";if(!t)return"E";u(e)}return e[r].i},f=function(e,t){if(!i(e,r)){if(!s(e))return!0;if(!t)return!1;u(e)}return e[r].w},h=function(e){return l&&d.NEED&&s(e)&&!i(e,r)&&u(e),e},d=t.exports={KEY:r,NEED:!1,fastKey:c,getWeak:f,onFreeze:h}},{"./_fails":83,"./_has":86,"./_is-object":94,"./_object-dp":107,"./_uid":135}],104:[function(e,t){var r=e("./_global"),n=e("./_task").set,i=r.MutationObserver||r.WebKitMutationObserver,a=r.process,o=r.Promise,s="process"==e("./_cof")(a);t.exports=function(){var e,t,l,u=function(){var r,n;for(s&&(r=a.domain)&&r.exit();e;){n=e.fn,e=e.next;try{n()}catch(i){throw e?l():t=void 0,i}}t=void 0,r&&r.enter()};if(s)l=function(){a.nextTick(u)};else if(i){var c=!0,f=document.createTextNode("");new i(u).observe(f,{characterData:!0}),l=function(){f.data=c=!c}}else if(o&&o.resolve){var h=o.resolve();l=function(){h.then(u)}}else l=function(){n.call(r,u)};return function(r){var n={fn:r,next:void 0};t&&(t.next=n),e||(e=n,l()),t=n}}},{"./_cof":70,"./_global":85,"./_task":128}],105:[function(e,t){"use strict";var r=e("./_object-keys"),n=e("./_object-gops"),i=e("./_object-pie"),a=e("./_to-object"),o=e("./_iobject"),s=Object.assign;t.exports=!s||e("./_fails")(function(){var e={},t={},r=Symbol(),n="abcdefghijklmnopqrst";return e[r]=7,n.split("").forEach(function(e){t[e]=e}),7!=s({},e)[r]||Object.keys(s({},t)).join("")!=n})?function(e){for(var t=a(e),s=arguments.length,l=1,u=n.f,c=i.f;s>l;)for(var f,h=o(arguments[l++]),d=u?r(h).concat(u(h)):r(h),p=d.length,m=0;p>m;)c.call(h,f=d[m++])&&(t[f]=h[f]);return t}:s},{"./_fails":83,"./_iobject":91,"./_object-gops":112,"./_object-keys":115,"./_object-pie":116,"./_to-object":133}],106:[function(e,t){var r=e("./_an-object"),n=e("./_object-dps"),i=e("./_enum-bug-keys"),a=e("./_shared-key")("IE_PROTO"),o=function(){},s="prototype",l=function(){var t,r=e("./_dom-create")("iframe"),n=i.length,a="<",o=">";for(r.style.display="none",e("./_html").appendChild(r),r.src="javascript:",t=r.contentWindow.document,t.open(),t.write(a+"script"+o+"document.F=Object"+a+"/script"+o),t.close(),l=t.F;n--;)delete l[s][i[n]]; 3 return l()};t.exports=Object.create||function(e,t){var i;return null!==e?(o[s]=r(e),i=new o,o[s]=null,i[a]=e):i=l(),void 0===t?i:n(i,t)}},{"./_an-object":63,"./_dom-create":79,"./_enum-bug-keys":80,"./_html":88,"./_object-dps":108,"./_shared-key":124}],107:[function(e,t,r){var n=e("./_an-object"),i=e("./_ie8-dom-define"),a=e("./_to-primitive"),o=Object.defineProperty;r.f=e("./_descriptors")?Object.defineProperty:function(e,t,r){if(n(e),t=a(t,!0),n(r),i)try{return o(e,t,r)}catch(s){}if("get"in r||"set"in r)throw TypeError("Accessors not supported!");return"value"in r&&(e[t]=r.value),e}},{"./_an-object":63,"./_descriptors":78,"./_ie8-dom-define":89,"./_to-primitive":134}],108:[function(e,t){var r=e("./_object-dp"),n=e("./_an-object"),i=e("./_object-keys");t.exports=e("./_descriptors")?Object.defineProperties:function(e,t){n(e);for(var a,o=i(t),s=o.length,l=0;s>l;)r.f(e,a=o[l++],t[a]);return e}},{"./_an-object":63,"./_descriptors":78,"./_object-dp":107,"./_object-keys":115}],109:[function(e,t,r){var n=e("./_object-pie"),i=e("./_property-desc"),a=e("./_to-iobject"),o=e("./_to-primitive"),s=e("./_has"),l=e("./_ie8-dom-define"),u=Object.getOwnPropertyDescriptor;r.f=e("./_descriptors")?u:function(e,t){if(e=a(e),t=o(t,!0),l)try{return u(e,t)}catch(r){}return s(e,t)?i(!n.f.call(e,t),e[t]):void 0}},{"./_descriptors":78,"./_has":86,"./_ie8-dom-define":89,"./_object-pie":116,"./_property-desc":118,"./_to-iobject":131,"./_to-primitive":134}],110:[function(e,t){var r=e("./_to-iobject"),n=e("./_object-gopn").f,i={}.toString,a="object"==typeof window&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[],o=function(e){try{return n(e)}catch(t){return a.slice()}};t.exports.f=function(e){return a&&"[object Window]"==i.call(e)?o(e):n(r(e))}},{"./_object-gopn":111,"./_to-iobject":131}],111:[function(e,t,r){var n=e("./_object-keys-internal"),i=e("./_enum-bug-keys").concat("length","prototype");r.f=Object.getOwnPropertyNames||function(e){return n(e,i)}},{"./_enum-bug-keys":80,"./_object-keys-internal":114}],112:[function(e,t,r){r.f=Object.getOwnPropertySymbols},{}],113:[function(e,t){var r=e("./_has"),n=e("./_to-object"),i=e("./_shared-key")("IE_PROTO"),a=Object.prototype;t.exports=Object.getPrototypeOf||function(e){return e=n(e),r(e,i)?e[i]:"function"==typeof e.constructor&&e instanceof e.constructor?e.constructor.prototype:e instanceof Object?a:null}},{"./_has":86,"./_shared-key":124,"./_to-object":133}],114:[function(e,t){var r=e("./_has"),n=e("./_to-iobject"),i=e("./_array-includes")(!1),a=e("./_shared-key")("IE_PROTO");t.exports=function(e,t){var o,s=n(e),l=0,u=[];for(o in s)o!=a&&r(s,o)&&u.push(o);for(;t.length>l;)r(s,o=t[l++])&&(~i(u,o)||u.push(o));return u}},{"./_array-includes":65,"./_has":86,"./_shared-key":124,"./_to-iobject":131}],115:[function(e,t){var r=e("./_object-keys-internal"),n=e("./_enum-bug-keys");t.exports=Object.keys||function(e){return r(e,n)}},{"./_enum-bug-keys":80,"./_object-keys-internal":114}],116:[function(e,t,r){r.f={}.propertyIsEnumerable},{}],117:[function(e,t){var r=e("./_export"),n=e("./_core"),i=e("./_fails");t.exports=function(e,t){var a=(n.Object||{})[e]||Object[e],o={};o[e]=t(a),r(r.S+r.F*i(function(){a(1)}),"Object",o)}},{"./_core":74,"./_export":82,"./_fails":83}],118:[function(e,t){t.exports=function(e,t){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}}},{}],119:[function(e,t){var r=e("./_hide");t.exports=function(e,t,n){for(var i in t)n&&e[i]?e[i]=t[i]:r(e,i,t[i]);return e}},{"./_hide":87}],120:[function(e,t){t.exports=e("./_hide")},{"./_hide":87}],121:[function(e,t){var r=e("./_is-object"),n=e("./_an-object"),i=function(e,t){if(n(e),!r(t)&&null!==t)throw TypeError(t+": can't set as prototype!")};t.exports={set:Object.setPrototypeOf||("__proto__"in{}?function(t,r,n){try{n=e("./_ctx")(Function.call,e("./_object-gopd").f(Object.prototype,"__proto__").set,2),n(t,[]),r=!(t instanceof Array)}catch(a){r=!0}return function(e,t){return i(e,t),r?e.__proto__=t:n(e,t),e}}({},!1):void 0),check:i}},{"./_an-object":63,"./_ctx":76,"./_is-object":94,"./_object-gopd":109}],122:[function(e,t){"use strict";var r=e("./_global"),n=e("./_core"),i=e("./_object-dp"),a=e("./_descriptors"),o=e("./_wks")("species");t.exports=function(e){var t="function"==typeof n[e]?n[e]:r[e];a&&t&&!t[o]&&i.f(t,o,{configurable:!0,get:function(){return this}})}},{"./_core":74,"./_descriptors":78,"./_global":85,"./_object-dp":107,"./_wks":138}],123:[function(e,t){var r=e("./_object-dp").f,n=e("./_has"),i=e("./_wks")("toStringTag");t.exports=function(e,t,a){e&&!n(e=a?e:e.prototype,i)&&r(e,i,{configurable:!0,value:t})}},{"./_has":86,"./_object-dp":107,"./_wks":138}],124:[function(e,t){var r=e("./_shared")("keys"),n=e("./_uid");t.exports=function(e){return r[e]||(r[e]=n(e))}},{"./_shared":125,"./_uid":135}],125:[function(e,t){var r=e("./_global"),n="__core-js_shared__",i=r[n]||(r[n]={});t.exports=function(e){return i[e]||(i[e]={})}},{"./_global":85}],126:[function(e,t){var r=e("./_an-object"),n=e("./_a-function"),i=e("./_wks")("species");t.exports=function(e,t){var a,o=r(e).constructor;return void 0===o||void 0==(a=r(o)[i])?t:n(a)}},{"./_a-function":60,"./_an-object":63,"./_wks":138}],127:[function(e,t){var r=e("./_to-integer"),n=e("./_defined");t.exports=function(e){return function(t,i){var a,o,s=String(n(t)),l=r(i),u=s.length;return 0>l||l>=u?e?"":void 0:(a=s.charCodeAt(l),55296>a||a>56319||l+1===u||(o=s.charCodeAt(l+1))<56320||o>57343?e?s.charAt(l):a:e?s.slice(l,l+2):(a-55296<<10)+(o-56320)+65536)}}},{"./_defined":77,"./_to-integer":130}],128:[function(e,t){var r,n,i,a=e("./_ctx"),o=e("./_invoke"),s=e("./_html"),l=e("./_dom-create"),u=e("./_global"),c=u.process,f=u.setImmediate,h=u.clearImmediate,d=u.MessageChannel,p=0,m={},_="onreadystatechange",g=function(){var e=+this;if(m.hasOwnProperty(e)){var t=m[e];delete m[e],t()}},v=function(e){g.call(e.data)};f&&h||(f=function(e){for(var t=[],n=1;arguments.length>n;)t.push(arguments[n++]);return m[++p]=function(){o("function"==typeof e?e:Function(e),t)},r(p),p},h=function(e){delete m[e]},"process"==e("./_cof")(c)?r=function(e){c.nextTick(a(g,e,1))}:d?(n=new d,i=n.port2,n.port1.onmessage=v,r=a(i.postMessage,i,1)):u.addEventListener&&"function"==typeof postMessage&&!u.importScripts?(r=function(e){u.postMessage(e+"","*")},u.addEventListener("message",v,!1)):r=_ in l("script")?function(e){s.appendChild(l("script"))[_]=function(){s.removeChild(this),g.call(e)}}:function(e){setTimeout(a(g,e,1),0)}),t.exports={set:f,clear:h}},{"./_cof":70,"./_ctx":76,"./_dom-create":79,"./_global":85,"./_html":88,"./_invoke":90}],129:[function(e,t){var r=e("./_to-integer"),n=Math.max,i=Math.min;t.exports=function(e,t){return e=r(e),0>e?n(e+t,0):i(e,t)}},{"./_to-integer":130}],130:[function(e,t){var r=Math.ceil,n=Math.floor;t.exports=function(e){return isNaN(e=+e)?0:(e>0?n:r)(e)}},{}],131:[function(e,t){var r=e("./_iobject"),n=e("./_defined");t.exports=function(e){return r(n(e))}},{"./_defined":77,"./_iobject":91}],132:[function(e,t){var r=e("./_to-integer"),n=Math.min;t.exports=function(e){return e>0?n(r(e),9007199254740991):0}},{"./_to-integer":130}],133:[function(e,t){var r=e("./_defined");t.exports=function(e){return Object(r(e))}},{"./_defined":77}],134:[function(e,t){var r=e("./_is-object");t.exports=function(e,t){if(!r(e))return e;var n,i;if(t&&"function"==typeof(n=e.toString)&&!r(i=n.call(e)))return i;if("function"==typeof(n=e.valueOf)&&!r(i=n.call(e)))return i;if(!t&&"function"==typeof(n=e.toString)&&!r(i=n.call(e)))return i;throw TypeError("Can't convert object to primitive value")}},{"./_is-object":94}],135:[function(e,t){var r=0,n=Math.random();t.exports=function(e){return"Symbol(".concat(void 0===e?"":e,")_",(++r+n).toString(36))}},{}],136:[function(e,t){var r=e("./_global"),n=e("./_core"),i=e("./_library"),a=e("./_wks-ext"),o=e("./_object-dp").f;t.exports=function(e){var t=n.Symbol||(n.Symbol=i?{}:r.Symbol||{});"_"==e.charAt(0)||e in t||o(t,e,{value:a.f(e)})}},{"./_core":74,"./_global":85,"./_library":102,"./_object-dp":107,"./_wks-ext":137}],137:[function(e,t,r){r.f=e("./_wks")},{"./_wks":138}],138:[function(e,t){var r=e("./_shared")("wks"),n=e("./_uid"),i=e("./_global").Symbol,a="function"==typeof i,o=t.exports=function(e){return r[e]||(r[e]=a&&i[e]||(a?i:n)("Symbol."+e))};o.store=r},{"./_global":85,"./_shared":125,"./_uid":135}],139:[function(e,t){var r=e("./_classof"),n=e("./_wks")("iterator"),i=e("./_iterators");t.exports=e("./_core").getIteratorMethod=function(e){return void 0!=e?e[n]||e["@@iterator"]||i[r(e)]:void 0}},{"./_classof":69,"./_core":74,"./_iterators":100,"./_wks":138}],140:[function(e,t){var r=e("./_an-object"),n=e("./core.get-iterator-method");t.exports=e("./_core").getIterator=function(e){var t=n(e);if("function"!=typeof t)throw TypeError(e+" is not iterable!");return r(t.call(e))}},{"./_an-object":63,"./_core":74,"./core.get-iterator-method":139}],141:[function(e,t){var r=e("./_classof"),n=e("./_wks")("iterator"),i=e("./_iterators");t.exports=e("./_core").isIterable=function(e){var t=Object(e);return void 0!==t[n]||"@@iterator"in t||i.hasOwnProperty(r(t))}},{"./_classof":69,"./_core":74,"./_iterators":100,"./_wks":138}],142:[function(e){"use strict";var t=e("./_ctx"),r=e("./_export"),n=e("./_to-object"),i=e("./_iter-call"),a=e("./_is-array-iter"),o=e("./_to-length"),s=e("./_create-property"),l=e("./core.get-iterator-method");r(r.S+r.F*!e("./_iter-detect")(function(e){Array.from(e)}),"Array",{from:function(e){var r,u,c,f,h=n(e),d="function"==typeof this?this:Array,p=arguments.length,m=p>1?arguments[1]:void 0,_=void 0!==m,g=0,v=l(h);if(_&&(m=t(m,p>2?arguments[2]:void 0,2)),void 0==v||d==Array&&a(v))for(r=o(h.length),u=new d(r);r>g;g++)s(u,g,_?m(h[g],g):h[g]);else for(f=v.call(h),u=new d;!(c=f.next()).done;g++)s(u,g,_?i(f,m,[c.value,g],!0):c.value);return u.length=g,u}})},{"./_create-property":75,"./_ctx":76,"./_export":82,"./_is-array-iter":92,"./_iter-call":95,"./_iter-detect":98,"./_to-length":132,"./_to-object":133,"./core.get-iterator-method":139}],143:[function(e,t){"use strict";var r=e("./_add-to-unscopables"),n=e("./_iter-step"),i=e("./_iterators"),a=e("./_to-iobject");t.exports=e("./_iter-define")(Array,"Array",function(e,t){this._t=a(e),this._i=0,this._k=t},function(){var e=this._t,t=this._k,r=this._i++;return!e||r>=e.length?(this._t=void 0,n(1)):"keys"==t?n(0,r):"values"==t?n(0,e[r]):n(0,[r,e[r]])},"values"),i.Arguments=i.Array,r("keys"),r("values"),r("entries")},{"./_add-to-unscopables":61,"./_iter-define":97,"./_iter-step":99,"./_iterators":100,"./_to-iobject":131}],144:[function(e,t){"use strict";var r=e("./_collection-strong");t.exports=e("./_collection")("Map",function(e){return function(){return e(this,arguments.length>0?arguments[0]:void 0)}},{get:function(e){var t=r.getEntry(this,e);return t&&t.v},set:function(e,t){return r.def(this,0===e?0:e,t)}},r,!0)},{"./_collection":73,"./_collection-strong":71}],145:[function(e){var t=e("./_export");t(t.S,"Math",{log2:function(e){return Math.log(e)/Math.LN2}})},{"./_export":82}],146:[function(e){var t=e("./_export");t(t.S+t.F,"Object",{assign:e("./_object-assign")})},{"./_export":82,"./_object-assign":105}],147:[function(e){var t=e("./_export");t(t.S,"Object",{create:e("./_object-create")})},{"./_export":82,"./_object-create":106}],148:[function(e){var t=e("./_export");t(t.S+t.F*!e("./_descriptors"),"Object",{defineProperty:e("./_object-dp").f})},{"./_descriptors":78,"./_export":82,"./_object-dp":107}],149:[function(e){var t=e("./_is-object"),r=e("./_meta").onFreeze;e("./_object-sap")("freeze",function(e){return function(n){return e&&t(n)?e(r(n)):n}})},{"./_is-object":94,"./_meta":103,"./_object-sap":117}],150:[function(e){var t=e("./_to-iobject"),r=e("./_object-gopd").f;e("./_object-sap")("getOwnPropertyDescriptor",function(){return function(e,n){return r(t(e),n)}})},{"./_object-gopd":109,"./_object-sap":117,"./_to-iobject":131}],151:[function(e){var t=e("./_to-object"),r=e("./_object-gpo");e("./_object-sap")("getPrototypeOf",function(){return function(e){return r(t(e))}})},{"./_object-gpo":113,"./_object-sap":117,"./_to-object":133}],152:[function(e){var t=e("./_to-object"),r=e("./_object-keys");e("./_object-sap")("keys",function(){return function(e){return r(t(e))}})},{"./_object-keys":115,"./_object-sap":117,"./_to-object":133}],153:[function(e){var t=e("./_export");t(t.S,"Object",{setPrototypeOf:e("./_set-proto").set})},{"./_export":82,"./_set-proto":121}],154:[function(e,t,r){arguments[4][40][0].apply(r,arguments)},{dup:40}],155:[function(e){"use strict";var t,r,n,i=e("./_library"),a=e("./_global"),o=e("./_ctx"),s=e("./_classof"),l=e("./_export"),u=e("./_is-object"),c=e("./_a-function"),f=e("./_an-instance"),h=e("./_for-of"),d=e("./_species-constructor"),p=e("./_task").set,m=e("./_microtask")(),_="Promise",g=a.TypeError,v=a.process,y=a[_],v=a.process,b="process"==s(v),x=function(){},w=!!function(){try{var t=y.resolve(1),r=(t.constructor={})[e("./_wks")("species")]=function(e){e(x,x)};return(b||"function"==typeof PromiseRejectionEvent)&&t.then(x)instanceof r}catch(n){}}(),k=function(e,t){return e===t||e===y&&t===n},A=function(e){var t;return u(e)&&"function"==typeof(t=e.then)?t:!1},T=function(e){return k(y,e)?new E(e):new r(e)},E=r=function(e){var t,r;this.promise=new e(function(e,n){if(void 0!==t||void 0!==r)throw g("Bad Promise constructor");t=e,r=n}),this.resolve=c(t),this.reject=c(r)},S=function(e){try{e()}catch(t){return{error:t}}},R=function(e,t){if(!e._n){e._n=!0;var r=e._c;m(function(){for(var n=e._v,i=1==e._s,a=0,o=function(t){var r,a,o=i?t.ok:t.fail,s=t.resolve,l=t.reject,u=t.domain;try{o?(i||(2==e._h&&z(e),e._h=1),o===!0?r=n:(u&&u.enter(),r=o(n),u&&u.exit()),r===t.promise?l(g("Promise-chain cycle")):(a=A(r))?a.call(r,s,l):s(r)):l(n)}catch(c){l(c)}};r.length>a;)o(r[a++]);e._c=[],e._n=!1,t&&!e._h&&j(e)})}},j=function(e){p.call(a,function(){var t,r,n,i=e._v;if(M(e)&&(t=S(function(){b?v.emit("unhandledRejection",i,e):(r=a.onunhandledrejection)?r({promise:e,reason:i}):(n=a.console)&&n.error&&n.error("Unhandled promise rejection",i)}),e._h=b||M(e)?2:1),e._a=void 0,t)throw t.error})},M=function(e){if(1==e._h)return!1;for(var t,r=e._a||e._c,n=0;r.length>n;)if(t=r[n++],t.fail||!M(t.promise))return!1;return!0},z=function(e){p.call(a,function(){var t;b?v.emit("rejectionHandled",e):(t=a.onrejectionhandled)&&t({promise:e,reason:e._v})})},C=function(e){var t=this;t._d||(t._d=!0,t=t._w||t,t._v=e,t._s=2,t._a||(t._a=t._c.slice()),R(t,!0))},P=function(e){var t,r=this;if(!r._d){r._d=!0,r=r._w||r;try{if(r===e)throw g("Promise can't be resolved itself");(t=A(e))?m(function(){var n={_w:r,_d:!1};try{t.call(e,o(P,n,1),o(C,n,1))}catch(i){C.call(n,i)}}):(r._v=e,r._s=1,R(r,!1))}catch(n){C.call({_w:r,_d:!1},n)}}};w||(y=function(e){f(this,y,_,"_h"),c(e),t.call(this);try{e(o(P,this,1),o(C,this,1))}catch(r){C.call(this,r)}},t=function(){this._c=[],this._a=void 0,this._s=0,this._d=!1,this._v=void 0,this._h=0,this._n=!1},t.prototype=e("./_redefine-all")(y.prototype,{then:function(e,t){var r=T(d(this,y));return r.ok="function"==typeof e?e:!0,r.fail="function"==typeof t&&t,r.domain=b?v.domain:void 0,this._c.push(r),this._a&&this._a.push(r),this._s&&R(this,!1),r.promise},"catch":function(e){return this.then(void 0,e)}}),E=function(){var e=new t;this.promise=e,this.resolve=o(P,e,1),this.reject=o(C,e,1)}),l(l.G+l.W+l.F*!w,{Promise:y}),e("./_set-to-string-tag")(y,_),e("./_set-species")(_),n=e("./_core")[_],l(l.S+l.F*!w,_,{reject:function(e){var t=T(this),r=t.reject;return r(e),t.promise}}),l(l.S+l.F*(i||!w),_,{resolve:function(e){if(e instanceof y&&k(e.constructor,this))return e;var t=T(this),r=t.resolve;return r(e),t.promise}}),l(l.S+l.F*!(w&&e("./_iter-detect")(function(e){y.all(e)["catch"](x)})),_,{all:function(e){var t=this,r=T(t),n=r.resolve,i=r.reject,a=S(function(){var r=[],a=0,o=1;h(e,!1,function(e){var s=a++,l=!1;r.push(void 0),o++,t.resolve(e).then(function(e){l||(l=!0,r[s]=e,--o||n(r))},i)}),--o||n(r)});return a&&i(a.error),r.promise},race:function(e){var t=this,r=T(t),n=r.reject,i=S(function(){h(e,!1,function(e){t.resolve(e).then(r.resolve,n)})});return i&&n(i.error),r.promise}})},{"./_a-function":60,"./_an-instance":62,"./_classof":69,"./_core":74,"./_ctx":76,"./_export":82,"./_for-of":84,"./_global":85,"./_is-object":94,"./_iter-detect":98,"./_library":102,"./_microtask":104,"./_redefine-all":119,"./_set-species":122,"./_set-to-string-tag":123,"./_species-constructor":126,"./_task":128,"./_wks":138}],156:[function(e,t){"use strict";var r=e("./_collection-strong");t.exports=e("./_collection")("Set",function(e){return function(){return e(this,arguments.length>0?arguments[0]:void 0)}},{add:function(e){return r.def(this,e=0===e?0:e,e)}},r)},{"./_collection":73,"./_collection-strong":71}],157:[function(e){"use strict";var t=e("./_string-at")(!0);e("./_iter-define")(String,"String",function(e){this._t=String(e),this._i=0},function(){var e,r=this._t,n=this._i;return n>=r.length?{value:void 0,done:!0}:(e=t(r,n),this._i+=e.length,{value:e,done:!1})})},{"./_iter-define":97,"./_string-at":127}],158:[function(e){"use strict";var t=e("./_global"),r=e("./_has"),n=e("./_descriptors"),i=e("./_export"),a=e("./_redefine"),o=e("./_meta").KEY,s=e("./_fails"),l=e("./_shared"),u=e("./_set-to-string-tag"),c=e("./_uid"),f=e("./_wks"),h=e("./_wks-ext"),d=e("./_wks-define"),p=e("./_keyof"),m=e("./_enum-keys"),_=e("./_is-array"),g=e("./_an-object"),v=e("./_to-iobject"),y=e("./_to-primitive"),b=e("./_property-desc"),x=e("./_object-create"),w=e("./_object-gopn-ext"),k=e("./_object-gopd"),A=e("./_object-dp"),T=e("./_object-keys"),E=k.f,S=A.f,R=w.f,j=t.Symbol,M=t.JSON,z=M&&M.stringify,C="prototype",P=f("_hidden"),N=f("toPrimitive"),L={}.propertyIsEnumerable,O=l("symbol-registry"),I=l("symbols"),F=l("op-symbols"),U=Object[C],D="function"==typeof j,B=t.QObject,G=!B||!B[C]||!B[C].findChild,V=n&&s(function(){return 7!=x(S({},"a",{get:function(){return S(this,"a",{value:7}).a}})).a})?function(e,t,r){var n=E(U,t);n&&delete U[t],S(e,t,r),n&&e!==U&&S(U,t,n)}:S,W=function(e){var t=I[e]=x(j[C]);return t._k=e,t},q=D&&"symbol"==typeof j.iterator?function(e){return"symbol"==typeof e}:function(e){return e instanceof j},Z=function(e,t,n){return e===U&&Z(F,t,n),g(e),t=y(t,!0),g(n),r(I,t)?(n.enumerable?(r(e,P)&&e[P][t]&&(e[P][t]=!1),n=x(n,{enumerable:b(0,!1)})):(r(e,P)||S(e,P,b(1,{})),e[P][t]=!0),V(e,t,n)):S(e,t,n)},H=function(e,t){g(e);for(var r,n=m(t=v(t)),i=0,a=n.length;a>i;)Z(e,r=n[i++],t[r]);return e},X=function(e,t){return void 0===t?x(e):H(x(e),t)},Y=function(e){var t=L.call(this,e=y(e,!0));return this===U&&r(I,e)&&!r(F,e)?!1:t||!r(this,e)||!r(I,e)||r(this,P)&&this[P][e]?t:!0},J=function(e,t){if(e=v(e),t=y(t,!0),e!==U||!r(I,t)||r(F,t)){var n=E(e,t);return!n||!r(I,t)||r(e,P)&&e[P][t]||(n.enumerable=!0),n}},K=function(e){for(var t,n=R(v(e)),i=[],a=0;n.length>a;)r(I,t=n[a++])||t==P||t==o||i.push(t);return i},$=function(e){for(var t,n=e===U,i=R(n?F:v(e)),a=[],o=0;i.length>o;)r(I,t=i[o++])&&(n?r(U,t):!0)&&a.push(I[t]);return a};D||(j=function(){if(this instanceof j)throw TypeError("Symbol is not a constructor!");var e=c(arguments.length>0?arguments[0]:void 0),t=function(n){this===U&&t.call(F,n),r(this,P)&&r(this[P],e)&&(this[P][e]=!1),V(this,e,b(1,n))};return n&&G&&V(U,e,{configurable:!0,set:t}),W(e)},a(j[C],"toString",function(){return this._k}),k.f=J,A.f=Z,e("./_object-gopn").f=w.f=K,e("./_object-pie").f=Y,e("./_object-gops").f=$,n&&!e("./_library")&&a(U,"propertyIsEnumerable",Y,!0),h.f=function(e){return W(f(e))}),i(i.G+i.W+i.F*!D,{Symbol:j});for(var Q="hasInstance,isConcatSpreadable,iterator,match,replace,search,species,split,toPrimitive,toStringTag,unscopables".split(","),et=0;Q.length>et;)f(Q[et++]);for(var Q=T(f.store),et=0;Q.length>et;)d(Q[et++]);i(i.S+i.F*!D,"Symbol",{"for":function(e){return r(O,e+="")?O[e]:O[e]=j(e)},keyFor:function(e){if(q(e))return p(O,e);throw TypeError(e+" is not a symbol!")},useSetter:function(){G=!0},useSimple:function(){G=!1}}),i(i.S+i.F*!D,"Object",{create:X,defineProperty:Z,defineProperties:H,getOwnPropertyDescriptor:J,getOwnPropertyNames:K,getOwnPropertySymbols:$}),M&&i(i.S+i.F*(!D||s(function(){var e=j();return"[null]"!=z([e])||"{}"!=z({a:e})||"{}"!=z(Object(e))})),"JSON",{stringify:function(e){if(void 0!==e&&!q(e)){for(var t,r,n=[e],i=1;arguments.length>i;)n.push(arguments[i++]);return t=n[1],"function"==typeof t&&(r=t),(r||!_(t))&&(t=function(e,t){return r&&(t=r.call(this,e,t)),q(t)?void 0:t}),n[1]=t,z.apply(M,n)}}}),j[C][N]||e("./_hide")(j[C],N,j[C].valueOf),u(j,"Symbol"),u(Math,"Math",!0),u(t.JSON,"JSON",!0)},{"./_an-object":63,"./_descriptors":78,"./_enum-keys":81,"./_export":82,"./_fails":83,"./_global":85,"./_has":86,"./_hide":87,"./_is-array":93,"./_keyof":101,"./_library":102,"./_meta":103,"./_object-create":106,"./_object-dp":107,"./_object-gopd":109,"./_object-gopn":111,"./_object-gopn-ext":110,"./_object-gops":112,"./_object-keys":115,"./_object-pie":116,"./_property-desc":118,"./_redefine":120,"./_set-to-string-tag":123,"./_shared":125,"./_to-iobject":131,"./_to-primitive":134,"./_uid":135,"./_wks":138,"./_wks-define":136,"./_wks-ext":137}],159:[function(e){var t=e("./_export");t(t.P+t.R,"Map",{toJSON:e("./_collection-to-json")("Map")})},{"./_collection-to-json":72,"./_export":82}],160:[function(e){var t=e("./_export");t(t.P+t.R,"Set",{toJSON:e("./_collection-to-json")("Set")})},{"./_collection-to-json":72,"./_export":82}],161:[function(e){e("./_wks-define")("asyncIterator")},{"./_wks-define":136}],162:[function(e){e("./_wks-define")("observable")},{"./_wks-define":136}],163:[function(e){e("./es6.array.iterator");for(var t=e("./_global"),r=e("./_hide"),n=e("./_iterators"),i=e("./_wks")("toStringTag"),a=["NodeList","DOMTokenList","MediaList","StyleSheetList","CSSRuleList"],o=0;5>o;o++){var s=a[o],l=t[s],u=l&&l.prototype;u&&!u[i]&&r(u,i,s),n[s]=n.Array}},{"./_global":85,"./_hide":87,"./_iterators":100,"./_wks":138,"./es6.array.iterator":143}],164:[function(e,t,r){(function(e){function t(e){return Array.isArray?Array.isArray(e):"[object Array]"===_(e)}function n(e){return"boolean"==typeof e}function i(e){return null===e}function a(e){return null==e}function o(e){return"number"==typeof e}function s(e){return"string"==typeof e}function l(e){return"symbol"==typeof e}function u(e){return void 0===e}function c(e){return"[object RegExp]"===_(e)}function f(e){return"object"==typeof e&&null!==e}function h(e){return"[object Date]"===_(e)}function d(e){return"[object Error]"===_(e)||e instanceof Error}function p(e){return"function"==typeof e}function m(e){return null===e||"boolean"==typeof e||"number"==typeof e||"string"==typeof e||"symbol"==typeof e||"undefined"==typeof e}function _(e){return Object.prototype.toString.call(e)}r.isArray=t,r.isBoolean=n,r.isNull=i,r.isNullOrUndefined=a,r.isNumber=o,r.isString=s,r.isSymbol=l,r.isUndefined=u,r.isRegExp=c,r.isObject=f,r.isDate=h,r.isError=d,r.isFunction=p,r.isPrimitive=m,r.isBuffer=e.isBuffer}).call(this,{isBuffer:e("../../is-buffer/index.js")})},{"../../is-buffer/index.js":188}],165:[function(e,t,r){function n(e){return e=Math.round(e),0>e?0:e>255?255:e}function i(e){return 0>e?0:e>1?1:e}function a(e){return n("%"===e[e.length-1]?parseFloat(e)/100*255:parseInt(e))}function o(e){return i("%"===e[e.length-1]?parseFloat(e)/100:parseFloat(e))}function s(e,t,r){return 0>r?r+=1:r>1&&(r-=1),1>6*r?e+(t-e)*r*6:1>2*r?t:2>3*r?e+(t-e)*(2/3-r)*6:e}function l(e){var t=e.replace(/ /g,"").toLowerCase();if(t in u)return u[t].slice();if("#"===t[0]){if(4===t.length){var r=parseInt(t.substr(1),16);return r>=0&&4095>=r?[(3840&r)>>4|(3840&r)>>8,240&r|(240&r)>>4,15&r|(15&r)<<4,1]:null}if(7===t.length){var r=parseInt(t.substr(1),16);return r>=0&&16777215>=r?[(16711680&r)>>16,(65280&r)>>8,255&r,1]:null}return null}var i=t.indexOf("("),l=t.indexOf(")");if(-1!==i&&l+1===t.length){var c=t.substr(0,i),f=t.substr(i+1,l-(i+1)).split(","),h=1;switch(c){case"rgba":if(4!==f.length)return null;h=o(f.pop());case"rgb":return 3!==f.length?null:[a(f[0]),a(f[1]),a(f[2]),h];case"hsla":if(4!==f.length)return null;h=o(f.pop());case"hsl":if(3!==f.length)return null;var d=(parseFloat(f[0])%360+360)%360/360,p=o(f[1]),m=o(f[2]),_=.5>=m?m*(p+1):m+p-m*p,g=2*m-_;return[n(255*s(g,_,d+1/3)),n(255*s(g,_,d)),n(255*s(g,_,d-1/3)),h];default:return null}}return null}var u={transparent:[0,0,0,0],aliceblue:[240,248,255,1],antiquewhite:[250,235,215,1],aqua:[0,255,255,1],aquamarine:[127,255,212,1],azure:[240,255,255,1],beige:[245,245,220,1],bisque:[255,228,196,1],black:[0,0,0,1],blanchedalmond:[255,235,205,1],blue:[0,0,255,1],blueviolet:[138,43,226,1],brown:[165,42,42,1],burlywood:[222,184,135,1],cadetblue:[95,158,160,1],chartreuse:[127,255,0,1],chocolate:[210,105,30,1],coral:[255,127,80,1],cornflowerblue:[100,149,237,1],cornsilk:[255,248,220,1],crimson:[220,20,60,1],cyan:[0,255,255,1],darkblue:[0,0,139,1],darkcyan:[0,139,139,1],darkgoldenrod:[184,134,11,1],darkgray:[169,169,169,1],darkgreen:[0,100,0,1],darkgrey:[169,169,169,1],darkkhaki:[189,183,107,1],darkmagenta:[139,0,139,1],darkolivegreen:[85,107,47,1],darkorange:[255,140,0,1],darkorchid:[153,50,204,1],darkred:[139,0,0,1],darksalmon:[233,150,122,1],darkseagreen:[143,188,143,1],darkslateblue:[72,61,139,1],darkslategray:[47,79,79,1],darkslategrey:[47,79,79,1],darkturquoise:[0,206,209,1],darkviolet:[148,0,211,1],deeppink:[255,20,147,1],deepskyblue:[0,191,255,1],dimgray:[105,105,105,1],dimgrey:[105,105,105,1],dodgerblue:[30,144,255,1],firebrick:[178,34,34,1],floralwhite:[255,250,240,1],forestgreen:[34,139,34,1],fuchsia:[255,0,255,1],gainsboro:[220,220,220,1],ghostwhite:[248,248,255,1],gold:[255,215,0,1],goldenrod:[218,165,32,1],gray:[128,128,128,1],green:[0,128,0,1],greenyellow:[173,255,47,1],grey:[128,128,128,1],honeydew:[240,255,240,1],hotpink:[255,105,180,1],indianred:[205,92,92,1],indigo:[75,0,130,1],ivory:[255,255,240,1],khaki:[240,230,140,1],lavender:[230,230,250,1],lavenderblush:[255,240,245,1],lawngreen:[124,252,0,1],lemonchiffon:[255,250,205,1],lightblue:[173,216,230,1],lightcoral:[240,128,128,1],lightcyan:[224,255,255,1],lightgoldenrodyellow:[250,250,210,1],lightgray:[211,211,211,1],lightgreen:[144,238,144,1],lightgrey:[211,211,211,1],lightpink:[255,182,193,1],lightsalmon:[255,160,122,1],lightseagreen:[32,178,170,1],lightskyblue:[135,206,250,1],lightslategray:[119,136,153,1],lightslategrey:[119,136,153,1],lightsteelblue:[176,196,222,1],lightyellow:[255,255,224,1],lime:[0,255,0,1],limegreen:[50,205,50,1],linen:[250,240,230,1],magenta:[255,0,255,1],maroon:[128,0,0,1],mediumaquamarine:[102,205,170,1],mediumblue:[0,0,205,1],mediumorchid:[186,85,211,1],mediumpurple:[147,112,219,1],mediumseagreen:[60,179,113,1],mediumslateblue:[123,104,238,1],mediumspringgreen:[0,250,154,1],mediumturquoise:[72,209,204,1],mediumvioletred:[199,21,133,1],midnightblue:[25,25,112,1],mintcream:[245,255,250,1],mistyrose:[255,228,225,1],moccasin:[255,228,181,1],navajowhite:[255,222,173,1],navy:[0,0,128,1],oldlace:[253,245,230,1],olive:[128,128,0,1],olivedrab:[107,142,35,1],orange:[255,165,0,1],orangered:[255,69,0,1],orchid:[218,112,214,1],palegoldenrod:[238,232,170,1],palegreen:[152,251,152,1],paleturquoise:[175,238,238,1],palevioletred:[219,112,147,1],papayawhip:[255,239,213,1],peachpuff:[255,218,185,1],peru:[205,133,63,1],pink:[255,192,203,1],plum:[221,160,221,1],powderblue:[176,224,230,1],purple:[128,0,128,1],rebeccapurple:[102,51,153,1],red:[255,0,0,1],rosybrown:[188,143,143,1],royalblue:[65,105,225,1],saddlebrown:[139,69,19,1],salmon:[250,128,114,1],sandybrown:[244,164,96,1],seagreen:[46,139,87,1],seashell:[255,245,238,1],sienna:[160,82,45,1],silver:[192,192,192,1],skyblue:[135,206,235,1],slateblue:[106,90,205,1],slategray:[112,128,144,1],slategrey:[112,128,144,1],snow:[255,250,250,1],springgreen:[0,255,127,1],steelblue:[70,130,180,1],tan:[210,180,140,1],teal:[0,128,128,1],thistle:[216,191,216,1],tomato:[255,99,71,1],turquoise:[64,224,208,1],violet:[238,130,238,1],wheat:[245,222,179,1],white:[255,255,255,1],whitesmoke:[245,245,245,1],yellow:[255,255,0,1],yellowgreen:[154,205,50,1]};try{r.parseCSSColor=l}catch(c){}},{}],166:[function(e,t){"use strict";function r(e,t,n){var i=0|e[n];if(0>=i)return[];var a,o=new Array(i);if(n===e.length-1)for(a=0;i>a;++a)o[a]=t;else for(a=0;i>a;++a)o[a]=r(e,t,n+1);return o}function n(e,t){var r,n;for(r=new Array(e),n=0;e>n;++n)r[n]=t;return r}function i(e,t){switch("undefined"==typeof t&&(t=0),typeof e){case"number":if(e>0)return n(0|e,t);break;case"object":if("number"==typeof e.length)return r(e,t,0)}return[]}t.exports=i},{}],167:[function(e,t){"use strict";function r(e,t,r){r=r||2;var i=t&&t.length,o=i?t[0]*r:e.length,s=n(e,0,o,r,!0),l=[];if(!s)return l;var u,f,h,d,p,m,_;if(i&&(s=c(e,t,s,r)),e.length>80*r){u=h=e[0],f=d=e[1];for(var g=r;o>g;g+=r)p=e[g],m=e[g+1],u>p&&(u=p),f>m&&(f=m),p>h&&(h=p),m>d&&(d=m);_=Math.max(h-u,d-f)}return a(s,l,r,u,f,_),l}function n(e,t,r,n,i){var a,o;if(i===M(e,t,r,n)>0)for(a=t;r>a;a+=n)o=S(a,e[a],e[a+1],o);else for(a=r-n;a>=t;a-=n)o=S(a,e[a],e[a+1],o);return o&&x(o,o.next)&&(R(o),o=o.next),o}function i(e,t){if(!e)return e;t||(t=e);var r,n=e;do if(r=!1,n.steiner||!x(n,n.next)&&0!==b(n.prev,n,n.next))n=n.next;else{if(R(n),n=t=n.prev,n===n.next)return null;r=!0}while(r||n!==t);return t}function a(e,t,r,n,c,f,h){if(e){!h&&f&&p(e,n,c,f);for(var d,m,_=e;e.prev!==e.next;)if(d=e.prev,m=e.next,f?s(e,n,c,f):o(e))t.push(d.i/r),t.push(e.i/r),t.push(m.i/r),R(e),e=m.next,_=m.next;else if(e=m,e===_){h?1===h?(e=l(e,t,r),a(e,t,r,n,c,f,2)):2===h&&u(e,t,r,n,c,f):a(i(e),t,r,n,c,f,1);break}}}function o(e){var t=e.prev,r=e,n=e.next;if(b(t,r,n)>=0)return!1;for(var i=e.next.next;i!==e.prev;){if(v(t.x,t.y,r.x,r.y,n.x,n.y,i.x,i.y)&&b(i.prev,i,i.next)>=0)return!1;i=i.next}return!0}function s(e,t,r,n){var i=e.prev,a=e,o=e.next;if(b(i,a,o)>=0)return!1;for(var s=i.x<a.x?i.x<o.x?i.x:o.x:a.x<o.x?a.x:o.x,l=i.y<a.y?i.y<o.y?i.y:o.y:a.y<o.y?a.y:o.y,u=i.x>a.x?i.x>o.x?i.x:o.x:a.x>o.x?a.x:o.x,c=i.y>a.y?i.y>o.y?i.y:o.y:a.y>o.y?a.y:o.y,f=_(s,l,t,r,n),h=_(u,c,t,r,n),d=e.nextZ;d&&d.z<=h;){if(d!==e.prev&&d!==e.next&&v(i.x,i.y,a.x,a.y,o.x,o.y,d.x,d.y)&&b(d.prev,d,d.next)>=0)return!1;d=d.nextZ}for(d=e.prevZ;d&&d.z>=f;){if(d!==e.prev&&d!==e.next&&v(i.x,i.y,a.x,a.y,o.x,o.y,d.x,d.y)&&b(d.prev,d,d.next)>=0)return!1;d=d.prevZ}return!0}function l(e,t,r){var n=e;do{var i=n.prev,a=n.next.next;!x(i,a)&&w(i,n,n.next,a)&&A(i,a)&&A(a,i)&&(t.push(i.i/r),t.push(n.i/r),t.push(a.i/r),R(n),R(n.next),n=e=a),n=n.next}while(n!==e);return n}function u(e,t,r,n,o,s){var l=e;do{for(var u=l.next.next;u!==l.prev;){if(l.i!==u.i&&y(l,u)){var c=E(l,u);return l=i(l,l.next),c=i(c,c.next),a(l,t,r,n,o,s),void a(c,t,r,n,o,s)}u=u.next}l=l.next}while(l!==e)}function c(e,t,r,a){var o,s,l,u,c,d=[];for(o=0,s=t.length;s>o;o++)l=t[o]*a,u=s-1>o?t[o+1]*a:e.length,c=n(e,l,u,a,!1),c===c.next&&(c.steiner=!0),d.push(g(c));for(d.sort(f),o=0;o<d.length;o++)h(d[o],r),r=i(r,r.next);return r}function f(e,t){return e.x-t.x}function h(e,t){if(t=d(e,t)){var r=E(t,e);i(r,r.next)}}function d(e,t){var r,n=t,i=e.x,a=e.y,o=-1/0;do{if(a<=n.y&&a>=n.next.y){var s=n.x+(a-n.y)*(n.next.x-n.x)/(n.next.y-n.y);if(i>=s&&s>o){if(o=s,s===i){if(a===n.y)return n;if(a===n.next.y)return n.next}r=n.x<n.next.x?n:n.next}}n=n.next}while(n!==t);if(!r)return null;if(i===o)return r.prev;var l,u=r,c=r.x,f=r.y,h=1/0;for(n=r.next;n!==u;)i>=n.x&&n.x>=c&&v(f>a?i:o,a,c,f,f>a?o:i,a,n.x,n.y)&&(l=Math.abs(a-n.y)/(i-n.x),(h>l||l===h&&n.x>r.x)&&A(n,e)&&(r=n,h=l)),n=n.next;return r}function p(e,t,r,n){var i=e;do null===i.z&&(i.z=_(i.x,i.y,t,r,n)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next;while(i!==e);i.prevZ.nextZ=null,i.prevZ=null,m(i)}function m(e){var t,r,n,i,a,o,s,l,u=1;do{for(r=e,e=null,a=null,o=0;r;){for(o++,n=r,s=0,t=0;u>t&&(s++,n=n.nextZ,n);t++);for(l=u;s>0||l>0&&n;)0===s?(i=n,n=n.nextZ,l--):0!==l&&n?r.z<=n.z?(i=r,r=r.nextZ,s--):(i=n,n=n.nextZ,l--):(i=r,r=r.nextZ,s--),a?a.nextZ=i:e=i,i.prevZ=a,a=i;r=n}a.nextZ=null,u*=2}while(o>1);return e}function _(e,t,r,n,i){return e=32767*(e-r)/i,t=32767*(t-n)/i,e=16711935&(e|e<<8),e=252645135&(e|e<<4),e=858993459&(e|e<<2),e=1431655765&(e|e<<1),t=16711935&(t|t<<8),t=252645135&(t|t<<4),t=858993459&(t|t<<2),t=1431655765&(t|t<<1),e|t<<1 4 }function g(e){var t=e,r=e;do t.x<r.x&&(r=t),t=t.next;while(t!==e);return r}function v(e,t,r,n,i,a,o,s){return(i-o)*(t-s)-(e-o)*(a-s)>=0&&(e-o)*(n-s)-(r-o)*(t-s)>=0&&(r-o)*(a-s)-(i-o)*(n-s)>=0}function y(e,t){return e.next.i!==t.i&&e.prev.i!==t.i&&!k(e,t)&&A(e,t)&&A(t,e)&&T(e,t)}function b(e,t,r){return(t.y-e.y)*(r.x-t.x)-(t.x-e.x)*(r.y-t.y)}function x(e,t){return e.x===t.x&&e.y===t.y}function w(e,t,r,n){return x(e,t)&&x(r,n)||x(e,n)&&x(r,t)?!0:b(e,t,r)>0!=b(e,t,n)>0&&b(r,n,e)>0!=b(r,n,t)>0}function k(e,t){var r=e;do{if(r.i!==e.i&&r.next.i!==e.i&&r.i!==t.i&&r.next.i!==t.i&&w(r,r.next,e,t))return!0;r=r.next}while(r!==e);return!1}function A(e,t){return b(e.prev,e,e.next)<0?b(e,t,e.next)>=0&&b(e,e.prev,t)>=0:b(e,t,e.prev)<0||b(e,e.next,t)<0}function T(e,t){var r=e,n=!1,i=(e.x+t.x)/2,a=(e.y+t.y)/2;do r.y>a!=r.next.y>a&&i<(r.next.x-r.x)*(a-r.y)/(r.next.y-r.y)+r.x&&(n=!n),r=r.next;while(r!==e);return n}function E(e,t){var r=new j(e.i,e.x,e.y),n=new j(t.i,t.x,t.y),i=e.next,a=t.prev;return e.next=t,t.prev=e,r.next=i,i.prev=r,n.next=r,r.prev=n,a.next=n,n.prev=a,n}function S(e,t,r,n){var i=new j(e,t,r);return n?(i.next=n.next,i.prev=n,n.next.prev=i,n.next=i):(i.prev=i,i.next=i),i}function R(e){e.next.prev=e.prev,e.prev.next=e.next,e.prevZ&&(e.prevZ.nextZ=e.nextZ),e.nextZ&&(e.nextZ.prevZ=e.prevZ)}function j(e,t,r){this.i=e,this.x=t,this.y=r,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1}function M(e,t,r,n){for(var i=0,a=t,o=r-n;r>a;a+=n)i+=(e[o]-e[a])*(e[a+1]+e[o+1]),o=a;return i}t.exports=r,r.deviation=function(e,t,r,n){var i=t&&t.length,a=i?t[0]*r:e.length,o=Math.abs(M(e,0,a,r));if(i)for(var s=0,l=t.length;l>s;s++){var u=t[s]*r,c=l-1>s?t[s+1]*r:e.length;o-=Math.abs(M(e,u,c,r))}var f=0;for(s=0;s<n.length;s+=3){var h=n[s]*r,d=n[s+1]*r,p=n[s+2]*r;f+=Math.abs((e[h]-e[p])*(e[d+1]-e[h+1])-(e[h]-e[d])*(e[p+1]-e[h+1]))}return 0===o&&0===f?0:Math.abs((f-o)/o)},r.flatten=function(e){for(var t=e[0][0].length,r={vertices:[],holes:[],dimensions:t},n=0,i=0;i<e.length;i++){for(var a=0;a<e[i].length;a++)for(var o=0;t>o;o++)r.vertices.push(e[i][a][o]);i>0&&(n+=e[i-1].length,r.holes.push(n))}return r}},{}],168:[function(e,t){function r(){this._events=this._events||{},this._maxListeners=this._maxListeners||void 0}function n(e){return"function"==typeof e}function i(e){return"number"==typeof e}function a(e){return"object"==typeof e&&null!==e}function o(e){return void 0===e}t.exports=r,r.EventEmitter=r,r.prototype._events=void 0,r.prototype._maxListeners=void 0,r.defaultMaxListeners=10,r.prototype.setMaxListeners=function(e){if(!i(e)||0>e||isNaN(e))throw TypeError("n must be a positive number");return this._maxListeners=e,this},r.prototype.emit=function(e){var t,r,i,s,l,u;if(this._events||(this._events={}),"error"===e&&(!this._events.error||a(this._events.error)&&!this._events.error.length)){if(t=arguments[1],t instanceof Error)throw t;var c=new Error('Uncaught, unspecified "error" event. ('+t+")");throw c.context=t,c}if(r=this._events[e],o(r))return!1;if(n(r))switch(arguments.length){case 1:r.call(this);break;case 2:r.call(this,arguments[1]);break;case 3:r.call(this,arguments[1],arguments[2]);break;default:s=Array.prototype.slice.call(arguments,1),r.apply(this,s)}else if(a(r))for(s=Array.prototype.slice.call(arguments,1),u=r.slice(),i=u.length,l=0;i>l;l++)u[l].apply(this,s);return!0},r.prototype.addListener=function(e,t){var i;if(!n(t))throw TypeError("listener must be a function");return this._events||(this._events={}),this._events.newListener&&this.emit("newListener",e,n(t.listener)?t.listener:t),this._events[e]?a(this._events[e])?this._events[e].push(t):this._events[e]=[this._events[e],t]:this._events[e]=t,a(this._events[e])&&!this._events[e].warned&&(i=o(this._maxListeners)?r.defaultMaxListeners:this._maxListeners,i&&i>0&&this._events[e].length>i&&(this._events[e].warned=!0,console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.",this._events[e].length),"function"==typeof console.trace&&console.trace())),this},r.prototype.on=r.prototype.addListener,r.prototype.once=function(e,t){function r(){this.removeListener(e,r),i||(i=!0,t.apply(this,arguments))}if(!n(t))throw TypeError("listener must be a function");var i=!1;return r.listener=t,this.on(e,r),this},r.prototype.removeListener=function(e,t){var r,i,o,s;if(!n(t))throw TypeError("listener must be a function");if(!this._events||!this._events[e])return this;if(r=this._events[e],o=r.length,i=-1,r===t||n(r.listener)&&r.listener===t)delete this._events[e],this._events.removeListener&&this.emit("removeListener",e,t);else if(a(r)){for(s=o;s-->0;)if(r[s]===t||r[s].listener&&r[s].listener===t){i=s;break}if(0>i)return this;1===r.length?(r.length=0,delete this._events[e]):r.splice(i,1),this._events.removeListener&&this.emit("removeListener",e,t)}return this},r.prototype.removeAllListeners=function(e){var t,r;if(!this._events)return this;if(!this._events.removeListener)return 0===arguments.length?this._events={}:this._events[e]&&delete this._events[e],this;if(0===arguments.length){for(t in this._events)"removeListener"!==t&&this.removeAllListeners(t);return this.removeAllListeners("removeListener"),this._events={},this}if(r=this._events[e],n(r))this.removeListener(e,r);else if(r)for(;r.length;)this.removeListener(e,r[r.length-1]);return delete this._events[e],this},r.prototype.listeners=function(e){var t;return t=this._events&&this._events[e]?n(this._events[e])?[this._events[e]]:this._events[e].slice():[]},r.prototype.listenerCount=function(e){if(this._events){var t=this._events[e];if(n(t))return 1;if(t)return t.length}return 0},r.listenerCount=function(e,t){return e.listenerCount(t)}},{}],169:[function(e,t){!function(){function e(e,t){c?e.addEventListener("scroll",t,!1):e.attachEvent("scroll",t)}function r(e){document.body?e():c?document.addEventListener("DOMContentLoaded",e):document.attachEvent("onreadystatechange",function(){"interactive"!=document.readyState&&"complete"!=document.readyState||e()})}function n(e){this.a=document.createElement("div"),this.a.setAttribute("aria-hidden","true"),this.a.appendChild(document.createTextNode(e)),this.b=document.createElement("span"),this.c=document.createElement("span"),this.h=document.createElement("span"),this.f=document.createElement("span"),this.g=-1,this.b.style.cssText="max-width:none;display:inline-block;position:absolute;height:100%;width:100%;overflow:scroll;font-size:16px;",this.c.style.cssText="max-width:none;display:inline-block;position:absolute;height:100%;width:100%;overflow:scroll;font-size:16px;",this.f.style.cssText="max-width:none;display:inline-block;position:absolute;height:100%;width:100%;overflow:scroll;font-size:16px;",this.h.style.cssText="display:inline-block;width:200%;height:200%;font-size:16px;max-width:none;",this.b.appendChild(this.h),this.c.appendChild(this.f),this.a.appendChild(this.b),this.a.appendChild(this.c)}function i(e,t){e.a.style.cssText="max-width:none;min-width:20px;min-height:20px;display:inline-block;overflow:hidden;position:absolute;width:auto;margin:0;padding:0;top:-999px;left:-999px;white-space:nowrap;font:"+t+";"}function a(e){var t=e.a.offsetWidth,r=t+100;return e.f.style.width=r+"px",e.c.scrollLeft=r,e.b.scrollLeft=e.b.scrollWidth+100,e.g!==t?(e.g=t,!0):!1}function o(t,r){function n(){var e=i;a(e)&&null!==e.a.parentNode&&r(e.g)}var i=t;e(t.b,n),e(t.c,n),a(t)}function s(e,t){var r=t||{};this.family=e,this.style=r.style||"normal",this.weight=r.weight||"normal",this.stretch=r.stretch||"normal"}function l(){if(null===h){var e=document.createElement("div");try{e.style.font="condensed 100px sans-serif"}catch(t){}h=""!==e.style.font}return h}function u(e,t){return[e.style,e.weight,l()?e.stretch:"","100px",t].join(" ")}var c=!!document.addEventListener,f=null,h=null,d=!!window.FontFace;s.prototype.load=function(e,t){var a=this,s=e||"BESbswy",l=t||3e3,c=(new Date).getTime();return new Promise(function(e,t){if(d){var h=new Promise(function(e,t){function r(){(new Date).getTime()-c>=l?t():document.fonts.load(u(a,a.family),s).then(function(t){1<=t.length?e():setTimeout(r,25)},function(){t()})}r()}),p=new Promise(function(e,t){setTimeout(t,l)});Promise.race([p,h]).then(function(){e(a)},function(){t(a)})}else r(function(){function r(){var t;(t=-1!=_&&-1!=g||-1!=_&&-1!=v||-1!=g&&-1!=v)&&((t=_!=g&&_!=v&&g!=v)||(null===f&&(t=/AppleWebKit\/([0-9]+)(?:\.([0-9]+))/.exec(window.navigator.userAgent),f=!!t&&(536>parseInt(t[1],10)||536===parseInt(t[1],10)&&11>=parseInt(t[2],10))),t=f&&(_==y&&g==y&&v==y||_==b&&g==b&&v==b||_==x&&g==x&&v==x)),t=!t),t&&(null!==w.parentNode&&w.parentNode.removeChild(w),clearTimeout(k),e(a))}function h(){if((new Date).getTime()-c>=l)null!==w.parentNode&&w.parentNode.removeChild(w),t(a);else{var e=document.hidden;(!0===e||void 0===e)&&(_=d.a.offsetWidth,g=p.a.offsetWidth,v=m.a.offsetWidth,r()),k=setTimeout(h,50)}}var d=new n(s),p=new n(s),m=new n(s),_=-1,g=-1,v=-1,y=-1,b=-1,x=-1,w=document.createElement("div"),k=0;w.dir="ltr",i(d,u(a,"sans-serif")),i(p,u(a,"serif")),i(m,u(a,"monospace")),w.appendChild(d.a),w.appendChild(p.a),w.appendChild(m.a),document.body.appendChild(w),y=d.a.offsetWidth,b=p.a.offsetWidth,x=m.a.offsetWidth,h(),o(d,function(e){_=e,r()}),i(d,u(a,'"'+a.family+'",sans-serif')),o(p,function(e){g=e,r()}),i(p,u(a,'"'+a.family+'",serif')),o(m,function(e){v=e,r()}),i(m,u(a,'"'+a.family+'",monospace'))})})},window.FontFaceObserver=s,window.FontFaceObserver.prototype.check=window.FontFaceObserver.prototype.load=s.prototype.load,"undefined"!=typeof t&&(t.exports=window.FontFaceObserver)}()},{}],170:[function(e,t){"use strict";function r(e,t,r,a,o,s,l,u){if(r/=t,a/=t,l>=r&&a>=u)return e;if(l>a||r>u)return null;for(var c=[],f=0;f<e.length;f++){var h,d,p=e[f],m=p.geometry,_=p.type;if(h=p.min[o],d=p.max[o],h>=r&&a>=d)c.push(p);else if(!(h>a||r>d)){var g=1===_?n(m,r,a,o):i(m,r,a,o,s,3===_);g.length&&c.push({geometry:g,type:_,tags:e[f].tags||null,min:p.min,max:p.max})}}return c.length?c:null}function n(e,t,r,n){for(var i=[],a=0;a<e.length;a++){var o=e[a],s=o[n];s>=t&&r>=s&&i.push(o)}return i}function i(e,t,r,n,i,o){for(var s=[],l=0;l<e.length;l++){var u,c,f,h=0,d=0,p=null,m=e[l],_=m.area,g=m.dist,v=m.length,y=[];for(c=0;v-1>c;c++)u=p||m[c],p=m[c+1],h=d||u[n],d=p[n],t>h?d>r?(y.push(i(u,p,t),i(u,p,r)),o||(y=a(s,y,_,g))):d>=t&&y.push(i(u,p,t)):h>r?t>d?(y.push(i(u,p,r),i(u,p,t)),o||(y=a(s,y,_,g))):r>=d&&y.push(i(u,p,r)):(y.push(u),t>d?(y.push(i(u,p,t)),o||(y=a(s,y,_,g))):d>r&&(y.push(i(u,p,r)),o||(y=a(s,y,_,g))));u=m[v-1],h=u[n],h>=t&&r>=h&&y.push(u),f=y[y.length-1],o&&f&&(y[0][0]!==f[0]||y[0][1]!==f[1])&&y.push(y[0]),a(s,y,_,g)}return s}function a(e,t,r,n){return t.length&&(t.area=r,t.dist=n,e.push(t)),[]}t.exports=r},{}],171:[function(e,t){"use strict";function r(e,t){var r=[];if("FeatureCollection"===e.type)for(var i=0;i<e.features.length;i++)n(r,e.features[i],t);else"Feature"===e.type?n(r,e,t):n(r,{geometry:e},t);return r}function n(e,t,r){var s,l,u,c=t.geometry,f=c.type,h=c.coordinates,d=t.properties;if("Point"===f)e.push(i(d,1,[o(h)]));else if("MultiPoint"===f)e.push(i(d,1,a(h)));else if("LineString"===f)e.push(i(d,2,[a(h,r)]));else if("MultiLineString"===f||"Polygon"===f){for(u=[],s=0;s<h.length;s++)u.push(a(h[s],r));e.push(i(d,"Polygon"===f?3:2,u))}else if("MultiPolygon"===f){for(u=[],s=0;s<h.length;s++)for(l=0;l<h[s].length;l++)u.push(a(h[s][l],r));e.push(i(d,3,u))}else{if("GeometryCollection"!==f)throw new Error("Input data is not a valid GeoJSON object.");for(s=0;s<c.geometries.length;s++)n(e,{geometry:c.geometries[s],properties:d},r)}}function i(e,t,r){var n={geometry:r,type:t,tags:e||null,min:[2,1],max:[-1,0]};return l(n),n}function a(e,t){for(var r=[],n=0;n<e.length;n++)r.push(o(e[n]));return t&&(c(r,t),s(r)),r}function o(e){var t=Math.sin(e[1]*Math.PI/180),r=e[0]/360+.5,n=.5-.25*Math.log((1+t)/(1-t))/Math.PI;return n=-1>n?-1:n>1?1:n,[r,n,0]}function s(e){for(var t,r,n=0,i=0,a=0;a<e.length-1;a++)t=r||e[a],r=e[a+1],n+=t[0]*r[1]-r[0]*t[1],i+=Math.abs(r[0]-t[0])+Math.abs(r[1]-t[1]);e.area=Math.abs(n/2),e.dist=i}function l(e){var t=e.geometry,r=e.min,n=e.max;if(1===e.type)u(r,n,t);else for(var i=0;i<t.length;i++)u(r,n,t[i]);return e}function u(e,t,r){for(var n,i=0;i<r.length;i++)n=r[i],e[0]=Math.min(n[0],e[0]),t[0]=Math.max(n[0],t[0]),e[1]=Math.min(n[1],e[1]),t[1]=Math.max(n[1],t[1])}t.exports=r;var c=e("./simplify")},{"./simplify":173}],172:[function(e,t){"use strict";function r(e,t){return new n(e,t)}function n(e,t){t=this.options=u(Object.create(this.options),t);var r=t.debug;r&&console.time("preprocess data");var n=1<<t.maxZoom,i=f(e,t.tolerance/(n*t.extent));this.tiles={},this.tileCoords=[],r&&(console.timeEnd("preprocess data"),console.log("index: maxZoom: %d, maxPoints: %d",t.indexMaxZoom,t.indexMaxPoints),console.time("generate tiles"),this.stats={},this.total=0),i=d(i,t.buffer/t.extent,s),i.length&&this.splitTile(i,0,0,0),r&&(i.length&&console.log("features: %d, points: %d",this.tiles[0].numFeatures,this.tiles[0].numPoints),console.timeEnd("generate tiles"),console.log("tiles generated:",this.total,JSON.stringify(this.stats)))}function i(e,t){if(e.transformed)return e;var r,n,i,o=e.z2,s=e.x,l=e.y;for(r=0;r<e.features.length;r++){var u=e.features[r],c=u.geometry,f=u.type;if(1===f)for(n=0;n<c.length;n++)c[n]=a(c[n],t,o,s,l);else for(n=0;n<c.length;n++){var h=c[n];for(i=0;i<h.length;i++)h[i]=a(h[i],t,o,s,l)}}return e.transformed=!0,e}function a(e,t,r,n,i){var a=Math.round(t*(e[0]*r-n)),o=Math.round(t*(e[1]*r-i));return[a,o]}function o(e,t,r){return 32*((1<<e)*r+t)+e}function s(e,t,r){return[r,(r-e[0])*(t[1]-e[1])/(t[0]-e[0])+e[1],1]}function l(e,t,r){return[(r-e[1])*(t[0]-e[0])/(t[1]-e[1])+e[0],r,1]}function u(e,t){for(var r in t)e[r]=t[r];return e}function c(e,t,r){var n=e.source;if(1!==n.length)return!1;var i=n[0];if(3!==i.type||i.geometry.length>1)return!1;var o=i.geometry[0].length;if(5!==o)return!1;for(var s=0;o>s;s++){var l=a(i.geometry[0][s],t,e.z2,e.x,e.y);if(l[0]!==-r&&l[0]!==t+r||l[1]!==-r&&l[1]!==t+r)return!1}return!0}t.exports=r;var f=e("./convert"),h=e("./clip"),d=e("./wrap"),p=e("./tile");n.prototype.options={maxZoom:14,indexMaxZoom:5,indexMaxPoints:1e5,solidChildren:!1,tolerance:3,extent:4096,buffer:64,debug:0},n.prototype.splitTile=function(e,t,r,n,i,a,u){for(var f=[e,t,r,n],d=this.options,m=d.debug;f.length;){n=f.pop(),r=f.pop(),t=f.pop(),e=f.pop();var _=1<<t,g=o(t,r,n),v=this.tiles[g],y=t===d.maxZoom?0:d.tolerance/(_*d.extent);if(!v&&(m>1&&console.time("creation"),v=this.tiles[g]=p(e,_,r,n,y,t===d.maxZoom),this.tileCoords.push({z:t,x:r,y:n}),m)){m>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",t,r,n,v.numFeatures,v.numPoints,v.numSimplified),console.timeEnd("creation"));var b="z"+t;this.stats[b]=(this.stats[b]||0)+1,this.total++}if(v.source=e,d.solidChildren||!c(v,d.extent,d.buffer)){if(i){if(t===d.maxZoom||t===i)continue;var x=1<<i-t;if(r!==Math.floor(a/x)||n!==Math.floor(u/x))continue}else if(t===d.indexMaxZoom||v.numPoints<=d.indexMaxPoints)continue;v.source=null,m>1&&console.time("clipping");var w,k,A,T,E,S,R=.5*d.buffer/d.extent,j=.5-R,M=.5+R,z=1+R;w=k=A=T=null,E=h(e,_,r-R,r+M,0,s,v.min[0],v.max[0]),S=h(e,_,r+j,r+z,0,s,v.min[0],v.max[0]),E&&(w=h(E,_,n-R,n+M,1,l,v.min[1],v.max[1]),k=h(E,_,n+j,n+z,1,l,v.min[1],v.max[1])),S&&(A=h(S,_,n-R,n+M,1,l,v.min[1],v.max[1]),T=h(S,_,n+j,n+z,1,l,v.min[1],v.max[1])),m>1&&console.timeEnd("clipping"),w&&f.push(w,t+1,2*r,2*n),k&&f.push(k,t+1,2*r,2*n+1),A&&f.push(A,t+1,2*r+1,2*n),T&&f.push(T,t+1,2*r+1,2*n+1)}}},n.prototype.getTile=function(e,t,r){var n=this.options,a=n.extent,s=n.debug,l=1<<e;t=(t%l+l)%l;var u=o(e,t,r);if(this.tiles[u])return i(this.tiles[u],a);s>1&&console.log("drilling down to z%d-%d-%d",e,t,r);for(var f,h=e,d=t,p=r;!f&&h>0;)h--,d=Math.floor(d/2),p=Math.floor(p/2),f=this.tiles[o(h,d,p)];if(!f)return null;if(s>1&&console.log("found parent tile z%d-%d-%d",h,d,p),f.source){if(c(f,a,n.buffer))return i(f,a);s>1&&console.time("drilling down"),this.splitTile(f.source,h,d,p,e,t,r),s>1&&console.timeEnd("drilling down")}return this.tiles[u]?i(this.tiles[u],a):null}},{"./clip":170,"./convert":171,"./tile":174,"./wrap":175}],173:[function(e,t){"use strict";function r(e,t){var r,i,a,o,s=t*t,l=e.length,u=0,c=l-1,f=[];for(e[u][2]=1,e[c][2]=1;c;){for(i=0,r=u+1;c>r;r++)a=n(e[r],e[u],e[c]),a>i&&(o=r,i=a);i>s?(e[o][2]=i,f.push(u),f.push(o),u=o):(c=f.pop(),u=f.pop())}}function n(e,t,r){var n=t[0],i=t[1],a=r[0],o=r[1],s=e[0],l=e[1],u=a-n,c=o-i;if(0!==u||0!==c){var f=((s-n)*u+(l-i)*c)/(u*u+c*c);f>1?(n=a,i=o):f>0&&(n+=u*f,i+=c*f)}return u=s-n,c=l-i,u*u+c*c}t.exports=r},{}],174:[function(e,t){"use strict";function r(e,t,r,i,a,o){for(var s={features:[],numPoints:0,numSimplified:0,numFeatures:0,source:null,x:r,y:i,z2:t,transformed:!1,min:[2,1],max:[-1,0]},l=0;l<e.length;l++){s.numFeatures++,n(s,e[l],a,o);var u=e[l].min,c=e[l].max;u[0]<s.min[0]&&(s.min[0]=u[0]),u[1]<s.min[1]&&(s.min[1]=u[1]),c[0]>s.max[0]&&(s.max[0]=c[0]),c[1]>s.max[1]&&(s.max[1]=c[1])}return s}function n(e,t,r,n){var i,a,o,s,l=t.geometry,u=t.type,c=[],f=r*r;if(1===u)for(i=0;i<l.length;i++)c.push(l[i]),e.numPoints++,e.numSimplified++;else for(i=0;i<l.length;i++)if(o=l[i],n||!(2===u&&o.dist<r||3===u&&o.area<f)){var h=[];for(a=0;a<o.length;a++)s=o[a],(n||s[2]>f)&&(h.push(s),e.numSimplified++),e.numPoints++;c.push(h)}else e.numPoints+=o.length;c.length&&e.features.push({geometry:c,type:u,tags:t.tags||null})}t.exports=r},{}],175:[function(e,t){"use strict";function r(e,t,r){var i=e,o=a(e,1,-1-t,t,0,r,-1,2),s=a(e,1,1-t,2+t,0,r,-1,2);return(o||s)&&(i=a(e,1,-t,1+t,0,r,-1,2),o&&(i=n(o,1).concat(i)),s&&(i=i.concat(n(s,-1)))),i}function n(e,t){for(var r=[],n=0;n<e.length;n++){var a,o=e[n],s=o.type;if(1===s)a=i(o.geometry,t);else{a=[];for(var l=0;l<o.geometry.length;l++)a.push(i(o.geometry[l],t))}r.push({geometry:a,type:s,tags:o.tags,min:[o.min[0]+t,o.min[1]],max:[o.max[0]+t,o.max[1]]})}return r}function i(e,t){var r=[];r.area=e.area,r.dist=e.dist;for(var n=0;n<e.length;n++)r.push([e[n][0]+t,e[n][1],e[n][2]]);return r}var a=e("./clip");t.exports=r},{"./clip":170}],176:[function(e,t){function r(e,t){var r=t[0],n=t[1],i=t[2],a=t[3],o=t[4],s=t[5],l=t[6],u=t[7],c=t[8],f=c*o-s*u,h=-c*a+s*l,d=u*a-o*l,p=r*f+n*h+i*d;return p?(p=1/p,e[0]=f*p,e[1]=(-c*n+i*u)*p,e[2]=(s*n-i*o)*p,e[3]=h*p,e[4]=(c*r-i*l)*p,e[5]=(-s*r+i*a)*p,e[6]=d*p,e[7]=(-u*r+n*l)*p,e[8]=(o*r-n*a)*p,e):null}t.exports=r},{}],177:[function(e,t){function r(e,t){var r=t[0],n=t[1],i=t[2],a=t[3],o=t[4],s=t[5],l=t[6],u=t[7],c=t[8],f=t[9],h=t[10],d=t[11],p=t[12],m=t[13],_=t[14],g=t[15],v=r*s-n*o,y=r*l-i*o,b=r*u-a*o,x=n*l-i*s,w=n*u-a*s,k=i*u-a*l,A=c*m-f*p,T=c*_-h*p,E=c*g-d*p,S=f*_-h*m,R=f*g-d*m,j=h*g-d*_,M=v*j-y*R+b*S+x*E-w*T+k*A;return M?(M=1/M,e[0]=(s*j-l*R+u*S)*M,e[1]=(l*E-o*j-u*T)*M,e[2]=(o*R-s*E+u*A)*M,e[3]=(i*R-n*j-a*S)*M,e[4]=(r*j-i*E+a*T)*M,e[5]=(n*E-r*R-a*A)*M,e[6]=(m*k-_*w+g*x)*M,e[7]=(_*b-p*k-g*y)*M,e[8]=(p*w-m*b+g*v)*M,e):null}t.exports=r},{}],178:[function(e,t){function r(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e[9]=t[9],e[10]=t[10],e[11]=t[11],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e}t.exports=r},{}],179:[function(e,t){function r(e){return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=1,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=1,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}t.exports=r},{}],180:[function(e,t){function r(e,t,r,i){var a,o,s,l,u,c,f,h,d,p,m=t[0],_=t[1],g=t[2],v=i[0],y=i[1],b=i[2],x=r[0],w=r[1],k=r[2];return Math.abs(m-x)<1e-6&&Math.abs(_-w)<1e-6&&Math.abs(g-k)<1e-6?n(e):(f=m-x,h=_-w,d=g-k,p=1/Math.sqrt(f*f+h*h+d*d),f*=p,h*=p,d*=p,a=y*d-b*h,o=b*f-v*d,s=v*h-y*f,p=Math.sqrt(a*a+o*o+s*s),p?(p=1/p,a*=p,o*=p,s*=p):(a=0,o=0,s=0),l=h*s-d*o,u=d*a-f*s,c=f*o-h*a,p=Math.sqrt(l*l+u*u+c*c),p?(p=1/p,l*=p,u*=p,c*=p):(l=0,u=0,c=0),e[0]=a,e[1]=l,e[2]=f,e[3]=0,e[4]=o,e[5]=u,e[6]=h,e[7]=0,e[8]=s,e[9]=c,e[10]=d,e[11]=0,e[12]=-(a*m+o*_+s*g),e[13]=-(l*m+u*_+c*g),e[14]=-(f*m+h*_+d*g),e[15]=1,e)}var n=e("./identity");t.exports=r},{"./identity":179}],181:[function(e,t){function r(e,t,r){var n=t[0],i=t[1],a=t[2],o=t[3],s=t[4],l=t[5],u=t[6],c=t[7],f=t[8],h=t[9],d=t[10],p=t[11],m=t[12],_=t[13],g=t[14],v=t[15],y=r[0],b=r[1],x=r[2],w=r[3];return e[0]=y*n+b*s+x*f+w*m,e[1]=y*i+b*l+x*h+w*_,e[2]=y*a+b*u+x*d+w*g,e[3]=y*o+b*c+x*p+w*v,y=r[4],b=r[5],x=r[6],w=r[7],e[4]=y*n+b*s+x*f+w*m,e[5]=y*i+b*l+x*h+w*_,e[6]=y*a+b*u+x*d+w*g,e[7]=y*o+b*c+x*p+w*v,y=r[8],b=r[9],x=r[10],w=r[11],e[8]=y*n+b*s+x*f+w*m,e[9]=y*i+b*l+x*h+w*_,e[10]=y*a+b*u+x*d+w*g,e[11]=y*o+b*c+x*p+w*v,y=r[12],b=r[13],x=r[14],w=r[15],e[12]=y*n+b*s+x*f+w*m,e[13]=y*i+b*l+x*h+w*_,e[14]=y*a+b*u+x*d+w*g,e[15]=y*o+b*c+x*p+w*v,e}t.exports=r},{}],182:[function(e,t){function r(e,t,r,n,i){var a=1/Math.tan(t/2),o=1/(n-i);return e[0]=a/r,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=a,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=(i+n)*o,e[11]=-1,e[12]=0,e[13]=0,e[14]=2*i*n*o,e[15]=0,e}t.exports=r},{}],183:[function(e,t){function r(e,t,r){var n=r[0],i=r[1],a=r[2];return e[0]=t[0]*n,e[1]=t[1]*n,e[2]=t[2]*n,e[3]=t[3]*n,e[4]=t[4]*i,e[5]=t[5]*i,e[6]=t[6]*i,e[7]=t[7]*i,e[8]=t[8]*a,e[9]=t[9]*a,e[10]=t[10]*a,e[11]=t[11]*a,e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e}t.exports=r},{}],184:[function(e,t){function r(e,t,r){var n,i,a,o,s,l,u,c,f,h,d,p,m=r[0],_=r[1],g=r[2];return t===e?(e[12]=t[0]*m+t[4]*_+t[8]*g+t[12],e[13]=t[1]*m+t[5]*_+t[9]*g+t[13],e[14]=t[2]*m+t[6]*_+t[10]*g+t[14],e[15]=t[3]*m+t[7]*_+t[11]*g+t[15]):(n=t[0],i=t[1],a=t[2],o=t[3],s=t[4],l=t[5],u=t[6],c=t[7],f=t[8],h=t[9],d=t[10],p=t[11],e[0]=n,e[1]=i,e[2]=a,e[3]=o,e[4]=s,e[5]=l,e[6]=u,e[7]=c,e[8]=f,e[9]=h,e[10]=d,e[11]=p,e[12]=n*m+s*_+f*g+t[12],e[13]=i*m+l*_+h*g+t[13],e[14]=a*m+u*_+d*g+t[14],e[15]=o*m+c*_+p*g+t[15]),e}t.exports=r},{}],185:[function(e,t){function r(e){e=String(e);for(var t,r=[];t=e.match(/ERROR\:([^\n]+)/);){e=e.slice(t.index+1);var n=t[1].trim(),i=n.split(":"),a=i.slice(2).join(":").trim(),o=parseInt(i[0],10),n=parseInt(i[1],10);r.push({message:a,file:o,line:n})}return r}t.exports=r},{}],186:[function(e,t,r){r.read=function(e,t,r,n,i){var a,o,s=8*i-n-1,l=(1<<s)-1,u=l>>1,c=-7,f=r?i-1:0,h=r?-1:1,d=e[t+f];for(f+=h,a=d&(1<<-c)-1,d>>=-c,c+=s;c>0;a=256*a+e[t+f],f+=h,c-=8);for(o=a&(1<<-c)-1,a>>=-c,c+=n;c>0;o=256*o+e[t+f],f+=h,c-=8);if(0===a)a=1-u;else{if(a===l)return o?0/0:1/0*(d?-1:1);o+=Math.pow(2,n),a-=u}return(d?-1:1)*o*Math.pow(2,a-n)},r.write=function(e,t,r,n,i,a){var o,s,l,u=8*a-i-1,c=(1<<u)-1,f=c>>1,h=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,d=n?0:a-1,p=n?1:-1,m=0>t||0===t&&0>1/t?1:0;for(t=Math.abs(t),isNaN(t)||1/0===t?(s=isNaN(t)?1:0,o=c):(o=Math.floor(Math.log(t)/Math.LN2),t*(l=Math.pow(2,-o))<1&&(o--,l*=2),t+=o+f>=1?h/l:h*Math.pow(2,1-f),t*l>=2&&(o++,l/=2),o+f>=c?(s=0,o=c):o+f>=1?(s=(t*l-1)*Math.pow(2,i),o+=f):(s=t*Math.pow(2,f-1)*Math.pow(2,i),o=0));i>=8;e[r+d]=255&s,d+=p,s/=256,i-=8);for(o=o<<i|s,u+=i;u>0;e[r+d]=255&o,d+=p,o/=256,u-=8);e[r+d-p]|=128*m}},{}],187:[function(e,t){t.exports="function"==typeof Object.create?function(e,t){e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})}:function(e,t){e.super_=t;var r=function(){};r.prototype=t.prototype,e.prototype=new r,e.prototype.constructor=e}},{}],188:[function(e,t){function r(e){return!!e.constructor&&"function"==typeof e.constructor.isBuffer&&e.constructor.isBuffer(e)}function n(e){return"function"==typeof e.readFloatLE&&"function"==typeof e.slice&&r(e.slice(0,0))}t.exports=function(e){return null!=e&&(r(e)||n(e)||!!e._isBuffer)}},{}],189:[function(e,t){var r={}.toString;t.exports=Array.isArray||function(e){return"[object Array]"==r.call(e)}},{}],190:[function(e,t){"use strict";var r=e("./lib/js-yaml.js");t.exports=r},{"./lib/js-yaml.js":191}],191:[function(e,t){"use strict";function r(e){return function(){throw new Error("Function "+e+" is deprecated and cannot be used.")}}var n=e("./js-yaml/loader");t.exports.Type=e("./js-yaml/type"),t.exports.Schema=e("./js-yaml/schema"),t.exports.FAILSAFE_SCHEMA=e("./js-yaml/schema/failsafe"),t.exports.JSON_SCHEMA=e("./js-yaml/schema/json"),t.exports.CORE_SCHEMA=e("./js-yaml/schema/core"),t.exports.DEFAULT_SAFE_SCHEMA=e("./js-yaml/schema/default_safe"),t.exports.DEFAULT_FULL_SCHEMA=e("./js-yaml/schema/default_full"),t.exports.load=n.load,t.exports.loadAll=n.loadAll,t.exports.safeLoad=n.safeLoad,t.exports.safeLoadAll=n.safeLoadAll,t.exports.YAMLException=e("./js-yaml/exception"),t.exports.MINIMAL_SCHEMA=e("./js-yaml/schema/failsafe"),t.exports.SAFE_SCHEMA=e("./js-yaml/schema/default_safe"),t.exports.DEFAULT_SCHEMA=e("./js-yaml/schema/default_full"),t.exports.scan=r("scan"),t.exports.parse=r("parse"),t.exports.compose=r("compose"),t.exports.addConstructor=r("addConstructor")},{"./js-yaml/exception":193,"./js-yaml/loader":194,"./js-yaml/schema":196,"./js-yaml/schema/core":197,"./js-yaml/schema/default_full":198,"./js-yaml/schema/default_safe":199,"./js-yaml/schema/failsafe":200,"./js-yaml/schema/json":201,"./js-yaml/type":202}],192:[function(e,t){"use strict";function r(e){return"undefined"==typeof e||null===e}function n(e){return"object"==typeof e&&null!==e}function i(e){return Array.isArray(e)?e:r(e)?[]:[e]}function a(e,t){var r,n,i,a;if(t)for(a=Object.keys(t),r=0,n=a.length;n>r;r+=1)i=a[r],e[i]=t[i];return e}function o(e,t){var r,n="";for(r=0;t>r;r+=1)n+=e;return n}function s(e){return 0===e&&Number.NEGATIVE_INFINITY===1/e}t.exports.isNothing=r,t.exports.isObject=n,t.exports.toArray=i,t.exports.repeat=o,t.exports.isNegativeZero=s,t.exports.extend=a},{}],193:[function(e,t){"use strict";function r(e,t){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=(new Error).stack||"",this.name="YAMLException",this.reason=e,this.mark=t,this.message=(this.reason||"(unknown reason)")+(this.mark?" "+this.mark.toString():"")}r.prototype=Object.create(Error.prototype),r.prototype.constructor=r,r.prototype.toString=function(e){var t=this.name+": ";return t+=this.reason||"(unknown reason)",!e&&this.mark&&(t+=" "+this.mark.toString()),t},t.exports=r},{}],194:[function(e,t){"use strict";function r(e){return 10===e||13===e}function n(e){return 9===e||32===e}function i(e){return 9===e||32===e||10===e||13===e}function a(e){return 44===e||91===e||93===e||123===e||125===e}function o(e){var t;return e>=48&&57>=e?e-48:(t=32|e,t>=97&&102>=t?t-97+10:-1)}function s(e){return 120===e?2:117===e?4:85===e?8:0}function l(e){return e>=48&&57>=e?e-48:-1}function u(e){return 48===e?"\x00":97===e?"":98===e?"\b":116===e?" ":9===e?" ":110===e?"\n":118===e?"":102===e?"\f":114===e?"\r":101===e?"":32===e?" ":34===e?'"':47===e?"/":92===e?"\\":78===e?" ":95===e?" ":76===e?"\u2028":80===e?"\u2029":""}function c(e){return 65535>=e?String.fromCharCode(e):String.fromCharCode((e-65536>>10)+55296,(e-65536&1023)+56320)}function f(e,t){this.input=e,this.filename=t.filename||null,this.schema=t.schema||V,this.onWarning=t.onWarning||null,this.legacy=t.legacy||!1,this.json=t.json||!1,this.listener=t.listener||null,this.implicitTypes=this.schema.compiledImplicit,this.typeMap=this.schema.compiledTypeMap,this.length=e.length,this.position=0,this.line=0,this.lineStart=0,this.lineIndent=0,this.documents=[]}function h(e,t){return new D(t,new B(e.filename,e.input,e.position,e.line,e.position-e.lineStart))}function d(e,t){throw h(e,t)}function p(e,t){e.onWarning&&e.onWarning.call(null,h(e,t))}function m(e,t,r,n){var i,a,o,s;if(r>t){if(s=e.input.slice(t,r),n)for(i=0,a=s.length;a>i;i+=1)o=s.charCodeAt(i),9===o||o>=32&&1114111>=o||d(e,"expected valid JSON character");else $.test(s)&&d(e,"the stream contains non-printable characters");e.result+=s}}function _(e,t,r,n){var i,a,o,s;for(U.isObject(r)||d(e,"cannot merge mappings; the provided source object is unacceptable"),i=Object.keys(r),o=0,s=i.length;s>o;o+=1)a=i[o],W.call(t,a)||(t[a]=r[a],n[a]=!0)}function g(e,t,r,n,i,a){var o,s;if(i=String(i),null===t&&(t={}),"tag:yaml.org,2002:merge"===n)if(Array.isArray(a))for(o=0,s=a.length;s>o;o+=1)_(e,t,a[o],r);else _(e,t,a,r);else e.json||W.call(r,i)||!W.call(t,i)||d(e,"duplicated mapping key"),t[i]=a,delete r[i];return t}function v(e){var t;t=e.input.charCodeAt(e.position),10===t?e.position++:13===t?(e.position++,10===e.input.charCodeAt(e.position)&&e.position++):d(e,"a line break is expected"),e.line+=1,e.lineStart=e.position}function y(e,t,i){for(var a=0,o=e.input.charCodeAt(e.position);0!==o;){for(;n(o);)o=e.input.charCodeAt(++e.position);if(t&&35===o)do o=e.input.charCodeAt(++e.position);while(10!==o&&13!==o&&0!==o);if(!r(o))break;for(v(e),o=e.input.charCodeAt(e.position),a++,e.lineIndent=0;32===o;)e.lineIndent++,o=e.input.charCodeAt(++e.position)}return-1!==i&&0!==a&&e.lineIndent<i&&p(e,"deficient indentation"),a}function b(e){var t,r=e.position;return t=e.input.charCodeAt(r),45!==t&&46!==t||t!==e.input.charCodeAt(r+1)||t!==e.input.charCodeAt(r+2)||(r+=3,t=e.input.charCodeAt(r),0!==t&&!i(t))?!1:!0}function x(e,t){1===t?e.result+=" ":t>1&&(e.result+=U.repeat("\n",t-1))}function w(e,t,o){var s,l,u,c,f,h,d,p,_,g=e.kind,v=e.result;if(_=e.input.charCodeAt(e.position),i(_)||a(_)||35===_||38===_||42===_||33===_||124===_||62===_||39===_||34===_||37===_||64===_||96===_)return!1;if((63===_||45===_)&&(l=e.input.charCodeAt(e.position+1),i(l)||o&&a(l)))return!1;for(e.kind="scalar",e.result="",u=c=e.position,f=!1;0!==_;){if(58===_){if(l=e.input.charCodeAt(e.position+1),i(l)||o&&a(l))break}else if(35===_){if(s=e.input.charCodeAt(e.position-1),i(s))break}else{if(e.position===e.lineStart&&b(e)||o&&a(_))break;if(r(_)){if(h=e.line,d=e.lineStart,p=e.lineIndent,y(e,!1,-1),e.lineIndent>=t){f=!0,_=e.input.charCodeAt(e.position);continue}e.position=c,e.line=h,e.lineStart=d,e.lineIndent=p;break}}f&&(m(e,u,c,!1),x(e,e.line-h),u=c=e.position,f=!1),n(_)||(c=e.position+1),_=e.input.charCodeAt(++e.position)}return m(e,u,c,!1),e.result?!0:(e.kind=g,e.result=v,!1)}function k(e,t){var n,i,a;if(n=e.input.charCodeAt(e.position),39!==n)return!1;for(e.kind="scalar",e.result="",e.position++,i=a=e.position;0!==(n=e.input.charCodeAt(e.position));)if(39===n){if(m(e,i,e.position,!0),n=e.input.charCodeAt(++e.position),39!==n)return!0;i=a=e.position,e.position++}else r(n)?(m(e,i,a,!0),x(e,y(e,!1,t)),i=a=e.position):e.position===e.lineStart&&b(e)?d(e,"unexpected end of the document within a single quoted scalar"):(e.position++,a=e.position);d(e,"unexpected end of the stream within a single quoted scalar")}function A(e,t){var n,i,a,l,u,f;if(f=e.input.charCodeAt(e.position),34!==f)return!1;for(e.kind="scalar",e.result="",e.position++,n=i=e.position;0!==(f=e.input.charCodeAt(e.position));){if(34===f)return m(e,n,e.position,!0),e.position++,!0;if(92===f){if(m(e,n,e.position,!0),f=e.input.charCodeAt(++e.position),r(f))y(e,!1,t);else if(256>f&&nt[f])e.result+=it[f],e.position++;else if((u=s(f))>0){for(a=u,l=0;a>0;a--)f=e.input.charCodeAt(++e.position),(u=o(f))>=0?l=(l<<4)+u:d(e,"expected hexadecimal character");e.result+=c(l),e.position++}else d(e,"unknown escape sequence");n=i=e.position}else r(f)?(m(e,n,i,!0),x(e,y(e,!1,t)),n=i=e.position):e.position===e.lineStart&&b(e)?d(e,"unexpected end of the document within a double quoted scalar"):(e.position++,i=e.position)}d(e,"unexpected end of the stream within a double quoted scalar")}function T(e,t){var r,n,a,o,s,l,u,c,f,h,p,m=!0,_=e.tag,v=e.anchor,b={};if(p=e.input.charCodeAt(e.position),91===p)o=93,u=!1,n=[];else{if(123!==p)return!1;o=125,u=!0,n={}}for(null!==e.anchor&&(e.anchorMap[e.anchor]=n),p=e.input.charCodeAt(++e.position);0!==p;){if(y(e,!0,t),p=e.input.charCodeAt(e.position),p===o)return e.position++,e.tag=_,e.anchor=v,e.kind=u?"mapping":"sequence",e.result=n,!0;m||d(e,"missed comma between flow collection entries"),f=c=h=null,s=l=!1,63===p&&(a=e.input.charCodeAt(e.position+1),i(a)&&(s=l=!0,e.position++,y(e,!0,t))),r=e.line,C(e,t,q,!1,!0),f=e.tag,c=e.result,y(e,!0,t),p=e.input.charCodeAt(e.position),!l&&e.line!==r||58!==p||(s=!0,p=e.input.charCodeAt(++e.position),y(e,!0,t),C(e,t,q,!1,!0),h=e.result),u?g(e,n,b,f,c,h):n.push(s?g(e,null,b,f,c,h):c),y(e,!0,t),p=e.input.charCodeAt(e.position),44===p?(m=!0,p=e.input.charCodeAt(++e.position)):m=!1 5 }d(e,"unexpected end of the stream within a flow collection")}function E(e,t){var i,a,o,s,u=Y,c=!1,f=t,h=0,p=!1;if(s=e.input.charCodeAt(e.position),124===s)a=!1;else{if(62!==s)return!1;a=!0}for(e.kind="scalar",e.result="";0!==s;)if(s=e.input.charCodeAt(++e.position),43===s||45===s)Y===u?u=43===s?K:J:d(e,"repeat of a chomping mode identifier");else{if(!((o=l(s))>=0))break;0===o?d(e,"bad explicit indentation width of a block scalar; it cannot be less than one"):c?d(e,"repeat of an indentation width identifier"):(f=t+o-1,c=!0)}if(n(s)){do s=e.input.charCodeAt(++e.position);while(n(s));if(35===s)do s=e.input.charCodeAt(++e.position);while(!r(s)&&0!==s)}for(;0!==s;){for(v(e),e.lineIndent=0,s=e.input.charCodeAt(e.position);(!c||e.lineIndent<f)&&32===s;)e.lineIndent++,s=e.input.charCodeAt(++e.position);if(!c&&e.lineIndent>f&&(f=e.lineIndent),r(s))h++;else{if(e.lineIndent<f){u===K?e.result+=U.repeat("\n",h):u===Y&&c&&(e.result+="\n");break}for(a?n(s)?(p=!0,e.result+=U.repeat("\n",h+1)):p?(p=!1,e.result+=U.repeat("\n",h+1)):0===h?c&&(e.result+=" "):e.result+=U.repeat("\n",h):e.result+=c?U.repeat("\n",h+1):U.repeat("\n",h),c=!0,h=0,i=e.position;!r(s)&&0!==s;)s=e.input.charCodeAt(++e.position);m(e,i,e.position,!1)}}return!0}function S(e,t){var r,n,a,o=e.tag,s=e.anchor,l=[],u=!1;for(null!==e.anchor&&(e.anchorMap[e.anchor]=l),a=e.input.charCodeAt(e.position);0!==a&&45===a&&(n=e.input.charCodeAt(e.position+1),i(n));)if(u=!0,e.position++,y(e,!0,-1)&&e.lineIndent<=t)l.push(null),a=e.input.charCodeAt(e.position);else if(r=e.line,C(e,t,H,!1,!0),l.push(e.result),y(e,!0,-1),a=e.input.charCodeAt(e.position),(e.line===r||e.lineIndent>t)&&0!==a)d(e,"bad indentation of a sequence entry");else if(e.lineIndent<t)break;return u?(e.tag=o,e.anchor=s,e.kind="sequence",e.result=l,!0):!1}function R(e,t,r){var a,o,s,l,u=e.tag,c=e.anchor,f={},h={},p=null,m=null,_=null,v=!1,b=!1;for(null!==e.anchor&&(e.anchorMap[e.anchor]=f),l=e.input.charCodeAt(e.position);0!==l;){if(a=e.input.charCodeAt(e.position+1),s=e.line,63!==l&&58!==l||!i(a)){if(!C(e,r,Z,!1,!0))break;if(e.line===s){for(l=e.input.charCodeAt(e.position);n(l);)l=e.input.charCodeAt(++e.position);if(58===l)l=e.input.charCodeAt(++e.position),i(l)||d(e,"a whitespace character is expected after the key-value separator within a block mapping"),v&&(g(e,f,h,p,m,null),p=m=_=null),b=!0,v=!1,o=!1,p=e.tag,m=e.result;else{if(!b)return e.tag=u,e.anchor=c,!0;d(e,"can not read an implicit mapping pair; a colon is missed")}}else{if(!b)return e.tag=u,e.anchor=c,!0;d(e,"can not read a block mapping entry; a multiline key may not be an implicit key")}}else 63===l?(v&&(g(e,f,h,p,m,null),p=m=_=null),b=!0,v=!0,o=!0):v?(v=!1,o=!0):d(e,"incomplete explicit mapping pair; a key node is missed"),e.position+=1,l=a;if((e.line===s||e.lineIndent>t)&&(C(e,t,X,!0,o)&&(v?m=e.result:_=e.result),v||(g(e,f,h,p,m,_),p=m=_=null),y(e,!0,-1),l=e.input.charCodeAt(e.position)),e.lineIndent>t&&0!==l)d(e,"bad indentation of a mapping entry");else if(e.lineIndent<t)break}return v&&g(e,f,h,p,m,null),b&&(e.tag=u,e.anchor=c,e.kind="mapping",e.result=f),b}function j(e){var t,r,n,a,o=!1,s=!1;if(a=e.input.charCodeAt(e.position),33!==a)return!1;if(null!==e.tag&&d(e,"duplication of a tag property"),a=e.input.charCodeAt(++e.position),60===a?(o=!0,a=e.input.charCodeAt(++e.position)):33===a?(s=!0,r="!!",a=e.input.charCodeAt(++e.position)):r="!",t=e.position,o){do a=e.input.charCodeAt(++e.position);while(0!==a&&62!==a);e.position<e.length?(n=e.input.slice(t,e.position),a=e.input.charCodeAt(++e.position)):d(e,"unexpected end of the stream within a verbatim tag")}else{for(;0!==a&&!i(a);)33===a&&(s?d(e,"tag suffix cannot contain exclamation marks"):(r=e.input.slice(t-1,e.position+1),tt.test(r)||d(e,"named tag handle cannot contain such characters"),s=!0,t=e.position+1)),a=e.input.charCodeAt(++e.position);n=e.input.slice(t,e.position),et.test(n)&&d(e,"tag suffix cannot contain flow indicator characters")}return n&&!rt.test(n)&&d(e,"tag name cannot contain such characters: "+n),o?e.tag=n:W.call(e.tagMap,r)?e.tag=e.tagMap[r]+n:"!"===r?e.tag="!"+n:"!!"===r?e.tag="tag:yaml.org,2002:"+n:d(e,'undeclared tag handle "'+r+'"'),!0}function M(e){var t,r;if(r=e.input.charCodeAt(e.position),38!==r)return!1;for(null!==e.anchor&&d(e,"duplication of an anchor property"),r=e.input.charCodeAt(++e.position),t=e.position;0!==r&&!i(r)&&!a(r);)r=e.input.charCodeAt(++e.position);return e.position===t&&d(e,"name of an anchor node must contain at least one character"),e.anchor=e.input.slice(t,e.position),!0}function z(e){var t,r,n;if(n=e.input.charCodeAt(e.position),42!==n)return!1;for(n=e.input.charCodeAt(++e.position),t=e.position;0!==n&&!i(n)&&!a(n);)n=e.input.charCodeAt(++e.position);return e.position===t&&d(e,"name of an alias node must contain at least one character"),r=e.input.slice(t,e.position),e.anchorMap.hasOwnProperty(r)||d(e,'unidentified alias "'+r+'"'),e.result=e.anchorMap[r],y(e,!0,-1),!0}function C(e,t,r,n,i){var a,o,s,l,u,c,f,h,p=1,m=!1,_=!1;if(null!==e.listener&&e.listener("open",e),e.tag=null,e.anchor=null,e.kind=null,e.result=null,a=o=s=X===r||H===r,n&&y(e,!0,-1)&&(m=!0,e.lineIndent>t?p=1:e.lineIndent===t?p=0:e.lineIndent<t&&(p=-1)),1===p)for(;j(e)||M(e);)y(e,!0,-1)?(m=!0,s=a,e.lineIndent>t?p=1:e.lineIndent===t?p=0:e.lineIndent<t&&(p=-1)):s=!1;if(s&&(s=m||i),(1===p||X===r)&&(f=q===r||Z===r?t:t+1,h=e.position-e.lineStart,1===p?s&&(S(e,h)||R(e,h,f))||T(e,f)?_=!0:(o&&E(e,f)||k(e,f)||A(e,f)?_=!0:z(e)?(_=!0,(null!==e.tag||null!==e.anchor)&&d(e,"alias node should not have any properties")):w(e,f,q===r)&&(_=!0,null===e.tag&&(e.tag="?")),null!==e.anchor&&(e.anchorMap[e.anchor]=e.result)):0===p&&(_=s&&S(e,h))),null!==e.tag&&"!"!==e.tag)if("?"===e.tag){for(l=0,u=e.implicitTypes.length;u>l;l+=1)if(c=e.implicitTypes[l],c.resolve(e.result)){e.result=c.construct(e.result),e.tag=c.tag,null!==e.anchor&&(e.anchorMap[e.anchor]=e.result);break}}else W.call(e.typeMap,e.tag)?(c=e.typeMap[e.tag],null!==e.result&&c.kind!==e.kind&&d(e,"unacceptable node kind for !<"+e.tag+'> tag; it should be "'+c.kind+'", not "'+e.kind+'"'),c.resolve(e.result)?(e.result=c.construct(e.result),null!==e.anchor&&(e.anchorMap[e.anchor]=e.result)):d(e,"cannot resolve a node with !<"+e.tag+"> explicit tag")):d(e,"unknown tag !<"+e.tag+">");return null!==e.listener&&e.listener("close",e),null!==e.tag||null!==e.anchor||_}function P(e){var t,a,o,s,l=e.position,u=!1;for(e.version=null,e.checkLineBreaks=e.legacy,e.tagMap={},e.anchorMap={};0!==(s=e.input.charCodeAt(e.position))&&(y(e,!0,-1),s=e.input.charCodeAt(e.position),!(e.lineIndent>0||37!==s));){for(u=!0,s=e.input.charCodeAt(++e.position),t=e.position;0!==s&&!i(s);)s=e.input.charCodeAt(++e.position);for(a=e.input.slice(t,e.position),o=[],a.length<1&&d(e,"directive name must not be less than one character in length");0!==s;){for(;n(s);)s=e.input.charCodeAt(++e.position);if(35===s){do s=e.input.charCodeAt(++e.position);while(0!==s&&!r(s));break}if(r(s))break;for(t=e.position;0!==s&&!i(s);)s=e.input.charCodeAt(++e.position);o.push(e.input.slice(t,e.position))}0!==s&&v(e),W.call(ot,a)?ot[a](e,a,o):p(e,'unknown document directive "'+a+'"')}return y(e,!0,-1),0===e.lineIndent&&45===e.input.charCodeAt(e.position)&&45===e.input.charCodeAt(e.position+1)&&45===e.input.charCodeAt(e.position+2)?(e.position+=3,y(e,!0,-1)):u&&d(e,"directives end mark is expected"),C(e,e.lineIndent-1,X,!1,!0),y(e,!0,-1),e.checkLineBreaks&&Q.test(e.input.slice(l,e.position))&&p(e,"non-ASCII line breaks are interpreted as content"),e.documents.push(e.result),e.position===e.lineStart&&b(e)?void(46===e.input.charCodeAt(e.position)&&(e.position+=3,y(e,!0,-1))):void(e.position<e.length-1&&d(e,"end of the stream or a document separator is expected"))}function N(e,t){e=String(e),t=t||{},0!==e.length&&(10!==e.charCodeAt(e.length-1)&&13!==e.charCodeAt(e.length-1)&&(e+="\n"),65279===e.charCodeAt(0)&&(e=e.slice(1)));var r=new f(e,t);for(r.input+="\x00";32===r.input.charCodeAt(r.position);)r.lineIndent+=1,r.position+=1;for(;r.position<r.length-1;)P(r);return r.documents}function L(e,t,r){var n,i,a=N(e,r);for(n=0,i=a.length;i>n;n+=1)t(a[n])}function O(e,t){var r=N(e,t);if(0===r.length)return void 0;if(1===r.length)return r[0];throw new D("expected a single document in the stream, but found more")}function I(e,t,r){L(e,t,U.extend({schema:G},r))}function F(e,t){return O(e,U.extend({schema:G},t))}for(var U=e("./common"),D=e("./exception"),B=e("./mark"),G=e("./schema/default_safe"),V=e("./schema/default_full"),W=Object.prototype.hasOwnProperty,q=1,Z=2,H=3,X=4,Y=1,J=2,K=3,$=/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,Q=/[\x85\u2028\u2029]/,et=/[,\[\]\{\}]/,tt=/^(?:!|!!|![a-z\-]+!)$/i,rt=/^(?:!|[^,\[\]\{\}])(?:%[0-9a-f]{2}|[0-9a-z\-#;\/\?:@&=\+\$,_\.!~\*'\(\)\[\]])*$/i,nt=new Array(256),it=new Array(256),at=0;256>at;at++)nt[at]=u(at)?1:0,it[at]=u(at);var ot={YAML:function(e,t,r){var n,i,a;null!==e.version&&d(e,"duplication of %YAML directive"),1!==r.length&&d(e,"YAML directive accepts exactly one argument"),n=/^([0-9]+)\.([0-9]+)$/.exec(r[0]),null===n&&d(e,"ill-formed argument of the YAML directive"),i=parseInt(n[1],10),a=parseInt(n[2],10),1!==i&&d(e,"unacceptable YAML version of the document"),e.version=r[0],e.checkLineBreaks=2>a,1!==a&&2!==a&&p(e,"unsupported YAML version of the document")},TAG:function(e,t,r){var n,i;2!==r.length&&d(e,"TAG directive accepts exactly two arguments"),n=r[0],i=r[1],tt.test(n)||d(e,"ill-formed tag handle (first argument) of the TAG directive"),W.call(e.tagMap,n)&&d(e,'there is a previously declared suffix for "'+n+'" tag handle'),rt.test(i)||d(e,"ill-formed tag prefix (second argument) of the TAG directive"),e.tagMap[n]=i}};t.exports.loadAll=L,t.exports.load=O,t.exports.safeLoadAll=I,t.exports.safeLoad=F},{"./common":192,"./exception":193,"./mark":195,"./schema/default_full":198,"./schema/default_safe":199}],195:[function(e,t){"use strict";function r(e,t,r,n,i){this.name=e,this.buffer=t,this.position=r,this.line=n,this.column=i}var n=e("./common");r.prototype.getSnippet=function(e,t){var r,i,a,o,s;if(!this.buffer)return null;for(e=e||4,t=t||75,r="",i=this.position;i>0&&-1==="\x00\r\n \u2028\u2029".indexOf(this.buffer.charAt(i-1));)if(i-=1,this.position-i>t/2-1){r=" ... ",i+=5;break}for(a="",o=this.position;o<this.buffer.length&&-1==="\x00\r\n \u2028\u2029".indexOf(this.buffer.charAt(o));)if(o+=1,o-this.position>t/2-1){a=" ... ",o-=5;break}return s=this.buffer.slice(i,o),n.repeat(" ",e)+r+s+a+"\n"+n.repeat(" ",e+this.position-i+r.length)+"^"},r.prototype.toString=function(e){var t,r="";return this.name&&(r+='in "'+this.name+'" '),r+="at line "+(this.line+1)+", column "+(this.column+1),e||(t=this.getSnippet(),t&&(r+=":\n"+t)),r},t.exports=r},{"./common":192}],196:[function(e,t){"use strict";function r(e,t,n){var i=[];return e.include.forEach(function(e){n=r(e,t,n)}),e[t].forEach(function(e){n.forEach(function(t,r){t.tag===e.tag&&i.push(r)}),n.push(e)}),n.filter(function(e,t){return-1===i.indexOf(t)})}function n(){function e(e){n[e.tag]=e}var t,r,n={};for(t=0,r=arguments.length;r>t;t+=1)arguments[t].forEach(e);return n}function i(e){this.include=e.include||[],this.implicit=e.implicit||[],this.explicit=e.explicit||[],this.implicit.forEach(function(e){if(e.loadKind&&"scalar"!==e.loadKind)throw new o("There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported.")}),this.compiledImplicit=r(this,"implicit",[]),this.compiledExplicit=r(this,"explicit",[]),this.compiledTypeMap=n(this.compiledImplicit,this.compiledExplicit)}var a=e("./common"),o=e("./exception"),s=e("./type");i.DEFAULT=null,i.create=function(){var e,t;switch(arguments.length){case 1:e=i.DEFAULT,t=arguments[0];break;case 2:e=arguments[0],t=arguments[1];break;default:throw new o("Wrong number of arguments for Schema.create function")}if(e=a.toArray(e),t=a.toArray(t),!e.every(function(e){return e instanceof i}))throw new o("Specified list of super schemas (or a single Schema object) contains a non-Schema object.");if(!t.every(function(e){return e instanceof s}))throw new o("Specified list of YAML types (or a single Type object) contains a non-Type object.");return new i({include:e,explicit:t})},t.exports=i},{"./common":192,"./exception":193,"./type":202}],197:[function(e,t){"use strict";var r=e("../schema");t.exports=new r({include:[e("./json")]})},{"../schema":196,"./json":201}],198:[function(e,t){"use strict";var r=e("../schema");t.exports=r.DEFAULT=new r({include:[e("./default_safe")],explicit:[e("../type/js/undefined"),e("../type/js/regexp"),e("../type/js/function")]})},{"../schema":196,"../type/js/function":207,"../type/js/regexp":208,"../type/js/undefined":209,"./default_safe":199}],199:[function(e,t){"use strict";var r=e("../schema");t.exports=new r({include:[e("./core")],implicit:[e("../type/timestamp"),e("../type/merge")],explicit:[e("../type/binary"),e("../type/omap"),e("../type/pairs"),e("../type/set")]})},{"../schema":196,"../type/binary":203,"../type/merge":211,"../type/omap":213,"../type/pairs":214,"../type/set":216,"../type/timestamp":218,"./core":197}],200:[function(e,t){"use strict";var r=e("../schema");t.exports=new r({explicit:[e("../type/str"),e("../type/seq"),e("../type/map")]})},{"../schema":196,"../type/map":210,"../type/seq":215,"../type/str":217}],201:[function(e,t){"use strict";var r=e("../schema");t.exports=new r({include:[e("./failsafe")],implicit:[e("../type/null"),e("../type/bool"),e("../type/int"),e("../type/float")]})},{"../schema":196,"../type/bool":204,"../type/float":205,"../type/int":206,"../type/null":212,"./failsafe":200}],202:[function(e,t){"use strict";function r(e){var t={};return null!==e&&Object.keys(e).forEach(function(r){e[r].forEach(function(e){t[String(e)]=r})}),t}function n(e,t){if(t=t||{},Object.keys(t).forEach(function(t){if(-1===a.indexOf(t))throw new i('Unknown option "'+t+'" is met in definition of "'+e+'" YAML type.')}),this.tag=e,this.kind=t.kind||null,this.resolve=t.resolve||function(){return!0},this.construct=t.construct||function(e){return e},this.instanceOf=t.instanceOf||null,this.predicate=t.predicate||null,this.represent=t.represent||null,this.defaultStyle=t.defaultStyle||null,this.styleAliases=r(t.styleAliases||null),-1===o.indexOf(this.kind))throw new i('Unknown kind "'+this.kind+'" is specified for "'+e+'" YAML type.')}var i=e("./exception"),a=["kind","resolve","construct","instanceOf","predicate","represent","defaultStyle","styleAliases"],o=["scalar","sequence","mapping"];t.exports=n},{"./exception":193}],203:[function(e,t){"use strict";function r(e){if(null===e)return!1;var t,r,n=0,i=e.length,a=l;for(r=0;i>r;r++)if(t=a.indexOf(e.charAt(r)),!(t>64)){if(0>t)return!1;n+=6}return n%8===0}function n(e){var t,r,n=e.replace(/[\r\n=]/g,""),i=n.length,a=l,s=0,u=[];for(t=0;i>t;t++)t%4===0&&t&&(u.push(s>>16&255),u.push(s>>8&255),u.push(255&s)),s=s<<6|a.indexOf(n.charAt(t));return r=i%4*6,0===r?(u.push(s>>16&255),u.push(s>>8&255),u.push(255&s)):18===r?(u.push(s>>10&255),u.push(s>>2&255)):12===r&&u.push(s>>4&255),o?new o(u):u}function i(e){var t,r,n="",i=0,a=e.length,o=l;for(t=0;a>t;t++)t%3===0&&t&&(n+=o[i>>18&63],n+=o[i>>12&63],n+=o[i>>6&63],n+=o[63&i]),i=(i<<8)+e[t];return r=a%3,0===r?(n+=o[i>>18&63],n+=o[i>>12&63],n+=o[i>>6&63],n+=o[63&i]):2===r?(n+=o[i>>10&63],n+=o[i>>4&63],n+=o[i<<2&63],n+=o[64]):1===r&&(n+=o[i>>2&63],n+=o[i<<4&63],n+=o[64],n+=o[64]),n}function a(e){return o&&o.isBuffer(e)}var o=e("buffer").Buffer,s=e("../type"),l="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\n\r";t.exports=new s("tag:yaml.org,2002:binary",{kind:"scalar",resolve:r,construct:n,predicate:a,represent:i})},{"../type":202,buffer:40}],204:[function(e,t){"use strict";function r(e){if(null===e)return!1;var t=e.length;return 4===t&&("true"===e||"True"===e||"TRUE"===e)||5===t&&("false"===e||"False"===e||"FALSE"===e)}function n(e){return"true"===e||"True"===e||"TRUE"===e}function i(e){return"[object Boolean]"===Object.prototype.toString.call(e)}var a=e("../type");t.exports=new a("tag:yaml.org,2002:bool",{kind:"scalar",resolve:r,construct:n,predicate:i,represent:{lowercase:function(e){return e?"true":"false"},uppercase:function(e){return e?"TRUE":"FALSE"},camelcase:function(e){return e?"True":"False"}},defaultStyle:"lowercase"})},{"../type":202}],205:[function(e,t){"use strict";function r(e){return null===e?!1:l.test(e)?!0:!1}function n(e){var t,r,n,i;return t=e.replace(/_/g,"").toLowerCase(),r="-"===t[0]?-1:1,i=[],"+-".indexOf(t[0])>=0&&(t=t.slice(1)),".inf"===t?1===r?Number.POSITIVE_INFINITY:Number.NEGATIVE_INFINITY:".nan"===t?0/0:t.indexOf(":")>=0?(t.split(":").forEach(function(e){i.unshift(parseFloat(e,10))}),t=0,n=1,i.forEach(function(e){t+=e*n,n*=60}),r*t):r*parseFloat(t,10)}function i(e,t){var r;if(isNaN(e))switch(t){case"lowercase":return".nan";case"uppercase":return".NAN";case"camelcase":return".NaN"}else if(Number.POSITIVE_INFINITY===e)switch(t){case"lowercase":return".inf";case"uppercase":return".INF";case"camelcase":return".Inf"}else if(Number.NEGATIVE_INFINITY===e)switch(t){case"lowercase":return"-.inf";case"uppercase":return"-.INF";case"camelcase":return"-.Inf"}else if(o.isNegativeZero(e))return"-0.0";return r=e.toString(10),u.test(r)?r.replace("e",".e"):r}function a(e){return"[object Number]"===Object.prototype.toString.call(e)&&(e%1!==0||o.isNegativeZero(e))}var o=e("../common"),s=e("../type"),l=new RegExp("^(?:[-+]?(?:[0-9][0-9_]*)\\.[0-9_]*(?:[eE][-+][0-9]+)?|\\.[0-9_]+(?:[eE][-+][0-9]+)?|[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\\.[0-9_]*|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$"),u=/^[-+]?[0-9]+e/;t.exports=new s("tag:yaml.org,2002:float",{kind:"scalar",resolve:r,construct:n,predicate:a,represent:i,defaultStyle:"lowercase"})},{"../common":192,"../type":202}],206:[function(e,t){"use strict";function r(e){return e>=48&&57>=e||e>=65&&70>=e||e>=97&&102>=e}function n(e){return e>=48&&55>=e}function i(e){return e>=48&&57>=e}function a(e){if(null===e)return!1;var t,a=e.length,o=0,s=!1;if(!a)return!1;if(t=e[o],("-"===t||"+"===t)&&(t=e[++o]),"0"===t){if(o+1===a)return!0;if(t=e[++o],"b"===t){for(o++;a>o;o++)if(t=e[o],"_"!==t){if("0"!==t&&"1"!==t)return!1;s=!0}return s}if("x"===t){for(o++;a>o;o++)if(t=e[o],"_"!==t){if(!r(e.charCodeAt(o)))return!1;s=!0}return s}for(;a>o;o++)if(t=e[o],"_"!==t){if(!n(e.charCodeAt(o)))return!1;s=!0}return s}for(;a>o;o++)if(t=e[o],"_"!==t){if(":"===t)break;if(!i(e.charCodeAt(o)))return!1;s=!0}return s?":"!==t?!0:/^(:[0-5]?[0-9])+$/.test(e.slice(o)):!1}function o(e){var t,r,n=e,i=1,a=[];return-1!==n.indexOf("_")&&(n=n.replace(/_/g,"")),t=n[0],("-"===t||"+"===t)&&("-"===t&&(i=-1),n=n.slice(1),t=n[0]),"0"===n?0:"0"===t?"b"===n[1]?i*parseInt(n.slice(2),2):"x"===n[1]?i*parseInt(n,16):i*parseInt(n,8):-1!==n.indexOf(":")?(n.split(":").forEach(function(e){a.unshift(parseInt(e,10))}),n=0,r=1,a.forEach(function(e){n+=e*r,r*=60}),i*n):i*parseInt(n,10)}function s(e){return"[object Number]"===Object.prototype.toString.call(e)&&e%1===0&&!l.isNegativeZero(e)}var l=e("../common"),u=e("../type");t.exports=new u("tag:yaml.org,2002:int",{kind:"scalar",resolve:a,construct:o,predicate:s,represent:{binary:function(e){return"0b"+e.toString(2)},octal:function(e){return"0"+e.toString(8)},decimal:function(e){return e.toString(10)},hexadecimal:function(e){return"0x"+e.toString(16).toUpperCase()}},defaultStyle:"decimal",styleAliases:{binary:[2,"bin"],octal:[8,"oct"],decimal:[10,"dec"],hexadecimal:[16,"hex"]}})},{"../common":192,"../type":202}],207:[function(e,t){"use strict";function r(e){if(null===e)return!1;try{var t="("+e+")",r=o.parse(t,{range:!0});return"Program"!==r.type||1!==r.body.length||"ExpressionStatement"!==r.body[0].type||"FunctionExpression"!==r.body[0].expression.type?!1:!0}catch(n){return!1}}function n(e){var t,r="("+e+")",n=o.parse(r,{range:!0}),i=[];if("Program"!==n.type||1!==n.body.length||"ExpressionStatement"!==n.body[0].type||"FunctionExpression"!==n.body[0].expression.type)throw new Error("Failed to resolve function");return n.body[0].expression.params.forEach(function(e){i.push(e.name)}),t=n.body[0].expression.body.range,new Function(i,r.slice(t[0]+1,t[1]-1))}function i(e){return e.toString()}function a(e){return"[object Function]"===Object.prototype.toString.call(e)}var o;try{var s=e;o=s("esprima")}catch(l){"undefined"!=typeof window&&(o=window.esprima)}var u=e("../../type");t.exports=new u("tag:yaml.org,2002:js/function",{kind:"scalar",resolve:r,construct:n,predicate:a,represent:i})},{"../../type":202}],208:[function(e,t){"use strict";function r(e){if(null===e)return!1;if(0===e.length)return!1;var t=e,r=/\/([gim]*)$/.exec(e),n="";if("/"===t[0]){if(r&&(n=r[1]),n.length>3)return!1;if("/"!==t[t.length-n.length-1])return!1}return!0}function n(e){var t=e,r=/\/([gim]*)$/.exec(e),n="";return"/"===t[0]&&(r&&(n=r[1]),t=t.slice(1,t.length-n.length-1)),new RegExp(t,n)}function i(e){var t="/"+e.source+"/";return e.global&&(t+="g"),e.multiline&&(t+="m"),e.ignoreCase&&(t+="i"),t}function a(e){return"[object RegExp]"===Object.prototype.toString.call(e)}var o=e("../../type");t.exports=new o("tag:yaml.org,2002:js/regexp",{kind:"scalar",resolve:r,construct:n,predicate:a,represent:i})},{"../../type":202}],209:[function(e,t){"use strict";function r(){return!0}function n(){return void 0}function i(){return""}function a(e){return"undefined"==typeof e}var o=e("../../type");t.exports=new o("tag:yaml.org,2002:js/undefined",{kind:"scalar",resolve:r,construct:n,predicate:a,represent:i})},{"../../type":202}],210:[function(e,t){"use strict";var r=e("../type");t.exports=new r("tag:yaml.org,2002:map",{kind:"mapping",construct:function(e){return null!==e?e:{}}})},{"../type":202}],211:[function(e,t){"use strict";function r(e){return"<<"===e||null===e}var n=e("../type");t.exports=new n("tag:yaml.org,2002:merge",{kind:"scalar",resolve:r})},{"../type":202}],212:[function(e,t){"use strict";function r(e){if(null===e)return!0;var t=e.length;return 1===t&&"~"===e||4===t&&("null"===e||"Null"===e||"NULL"===e)}function n(){return null}function i(e){return null===e}var a=e("../type");t.exports=new a("tag:yaml.org,2002:null",{kind:"scalar",resolve:r,construct:n,predicate:i,represent:{canonical:function(){return"~"},lowercase:function(){return"null"},uppercase:function(){return"NULL"},camelcase:function(){return"Null"}},defaultStyle:"lowercase"})},{"../type":202}],213:[function(e,t){"use strict";function r(e){if(null===e)return!0;var t,r,n,i,s,l=[],u=e;for(t=0,r=u.length;r>t;t+=1){if(n=u[t],s=!1,"[object Object]"!==o.call(n))return!1;for(i in n)if(a.call(n,i)){if(s)return!1;s=!0}if(!s)return!1;if(-1!==l.indexOf(i))return!1;l.push(i)}return!0}function n(e){return null!==e?e:[]}var i=e("../type"),a=Object.prototype.hasOwnProperty,o=Object.prototype.toString;t.exports=new i("tag:yaml.org,2002:omap",{kind:"sequence",resolve:r,construct:n})},{"../type":202}],214:[function(e,t){"use strict";function r(e){if(null===e)return!0;var t,r,n,i,o,s=e;for(o=new Array(s.length),t=0,r=s.length;r>t;t+=1){if(n=s[t],"[object Object]"!==a.call(n))return!1;if(i=Object.keys(n),1!==i.length)return!1;o[t]=[i[0],n[i[0]]]}return!0}function n(e){if(null===e)return[];var t,r,n,i,a,o=e;for(a=new Array(o.length),t=0,r=o.length;r>t;t+=1)n=o[t],i=Object.keys(n),a[t]=[i[0],n[i[0]]];return a}var i=e("../type"),a=Object.prototype.toString;t.exports=new i("tag:yaml.org,2002:pairs",{kind:"sequence",resolve:r,construct:n})},{"../type":202}],215:[function(e,t){"use strict";var r=e("../type");t.exports=new r("tag:yaml.org,2002:seq",{kind:"sequence",construct:function(e){return null!==e?e:[]}})},{"../type":202}],216:[function(e,t){"use strict";function r(e){if(null===e)return!0;var t,r=e;for(t in r)if(a.call(r,t)&&null!==r[t])return!1;return!0}function n(e){return null!==e?e:{}}var i=e("../type"),a=Object.prototype.hasOwnProperty;t.exports=new i("tag:yaml.org,2002:set",{kind:"mapping",resolve:r,construct:n})},{"../type":202}],217:[function(e,t){"use strict";var r=e("../type");t.exports=new r("tag:yaml.org,2002:str",{kind:"scalar",construct:function(e){return null!==e?e:""}})},{"../type":202}],218:[function(e,t){"use strict";function r(e){return null===e?!1:null===o.exec(e)?!1:!0}function n(e){var t,r,n,i,a,s,l,u,c,f,h=0,d=null;if(t=o.exec(e),null===t)throw new Error("Date resolve error");if(r=+t[1],n=+t[2]-1,i=+t[3],!t[4])return new Date(Date.UTC(r,n,i));if(a=+t[4],s=+t[5],l=+t[6],t[7]){for(h=t[7].slice(0,3);h.length<3;)h+="0";h=+h}return t[9]&&(u=+t[10],c=+(t[11]||0),d=6e4*(60*u+c),"-"===t[9]&&(d=-d)),f=new Date(Date.UTC(r,n,i,a,s,l,h)),d&&f.setTime(f.getTime()-d),f}function i(e){return e.toISOString()}var a=e("../type"),o=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9]?)-([0-9][0-9]?)(?:(?:[Tt]|[ \\t]+)([0-9][0-9]?):([0-9][0-9]):([0-9][0-9])(?:\\.([0-9]*))?(?:[ \\t]*(Z|([-+])([0-9][0-9]?)(?::([0-9][0-9]))?))?)?$");t.exports=new a("tag:yaml.org,2002:timestamp",{kind:"scalar",resolve:r,construct:n,instanceOf:Date,represent:i})},{"../type":202}],219:[function(e,t,r){"use strict";var n=(e("./utils"),e("./support")),i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";r.decode=function(e){var t,r,a,o,s,l,u,c=0,f=0;e=e.replace(/[^A-Za-z0-9\+\/\=]/g,"");var h=3*e.length/4;e.charAt(e.length-1)===i.charAt(64)&&h--,e.charAt(e.length-2)===i.charAt(64)&&h--;var d;for(d=n.uint8array?new Uint8Array(h):new Array(h);c<e.length;)o=i.indexOf(e.charAt(c++)),s=i.indexOf(e.charAt(c++)),l=i.indexOf(e.charAt(c++)),u=i.indexOf(e.charAt(c++)),t=o<<2|s>>4,r=(15&s)<<4|l>>2,a=(3&l)<<6|u,d[f++]=t,64!==l&&(d[f++]=r),64!==u&&(d[f++]=a);return d}},{"./support":245,"./utils":247}],220:[function(e,t){"use strict";function r(e,t,r,n,i){this.compressedSize=e,this.uncompressedSize=t,this.crc32=r,this.compression=n,this.compressedContent=i}var n=e("./external"),i=e("./stream/DataWorker"),a=e("./stream/DataLengthProbe"),o=e("./stream/Crc32Probe"),a=e("./stream/DataLengthProbe");r.prototype={getContentWorker:function(){var e=new i(n.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new a("data_length")),t=this;return e.on("end",function(){if(this.streamInfo.data_length!==t.uncompressedSize)throw new Error("Bug : uncompressed data size mismatch")}),e},getCompressedWorker:function(){return new i(n.Promise.resolve(this.compressedContent)).withStreamInfo("compressedSize",this.compressedSize).withStreamInfo("uncompressedSize",this.uncompressedSize).withStreamInfo("crc32",this.crc32).withStreamInfo("compression",this.compression)}},r.createWorkerFrom=function(e,t,r){return e.pipe(new o).pipe(new a("uncompressedSize")).pipe(t.compressWorker(r)).pipe(new a("compressedSize")).withStreamInfo("compression",t)},t.exports=r},{"./external":224,"./stream/Crc32Probe":240,"./stream/DataLengthProbe":241,"./stream/DataWorker":242}],221:[function(e,t,r){"use strict";var n=e("./stream/GenericWorker");r.STORE={magic:"\x00\x00",uncompressWorker:function(){return new n("STORE decompression")}},r.DEFLATE=e("./flate")},{"./flate":225,"./stream/GenericWorker":243}],222:[function(e,t){"use strict";function r(){for(var e,t=[],r=0;256>r;r++){e=r;for(var n=0;8>n;n++)e=1&e?3988292384^e>>>1:e>>>1;t[r]=e}return t}function n(e,t,r,n){var i=o,a=n+r;e=-1^e;for(var s=n;a>s;s++)e=e>>>8^i[255&(e^t[s])];return-1^e}function i(e,t,r,n){var i=o,a=n+r;e=-1^e;for(var s=n;a>s;s++)e=e>>>8^i[255&(e^t.charCodeAt(s))];return-1^e}var a=e("./utils"),o=r();t.exports=function(e,t){if("undefined"==typeof e||!e.length)return 0;var r="string"!==a.getTypeOf(e);return r?n(0|t,e,e.length,0):i(0|t,e,e.length,0)}},{"./utils":247}],223:[function(e,t,r){"use strict";r.base64=!1,r.binary=!1,r.dir=!1,r.createFolders=!0,r.date=null,r.compression=null,r.compressionOptions=null,r.comment=null,r.unixPermissions=null,r.dosPermissions=null},{}],224:[function(e,t){"use strict";t.exports={Promise:window.Promise}},{}],225:[function(e,t,r){"use strict";function n(e,t){s.call(this,"FlateWorker/"+e),this._pako=new a[e]({raw:!0,level:t.level||-1}),this.meta={};var r=this;this._pako.onData=function(e){r.push({data:e,meta:r.meta})}}var i="undefined"!=typeof Uint8Array&&"undefined"!=typeof Uint16Array&&"undefined"!=typeof Uint32Array,a=e("pako"),o=e("./utils"),s=e("./stream/GenericWorker"),l=i?"uint8array":"array";r.magic="\b\x00",o.inherits(n,s),n.prototype.processChunk=function(e){this.meta=e.meta,this._pako.push(o.transformTo(l,e.data),!1)},n.prototype.flush=function(){s.prototype.flush.call(this),this._pako.push([],!0)},n.prototype.cleanUp=function(){s.prototype.cleanUp.call(this),this._pako=null},r.compressWorker=function(e){return new n("Deflate",e)},r.uncompressWorker=function(){return new n("Inflate",{})}},{"./stream/GenericWorker":243,"./utils":247,pako:259}],226:[function(e,t){"use strict";function r(){if(!(this instanceof r))return new r;if(arguments.length)throw new Error("The constructor with parameters has been removed in JSZip 3.0, please check the upgrade guide.");this.files={},this.comment=null,this.root="",this.clone=function(){var e=new r;for(var t in this)"function"!=typeof this[t]&&(e[t]=this[t]);return e}}r.prototype=e("./object"),r.prototype.loadAsync=e("./load"),r.support=e("./support"),r.defaults=e("./defaults"),r.loadAsync=function(e,t){return(new r).loadAsync(e,t)},r.external=e("./external"),t.exports=r},{"./defaults":223,"./external":224,"./load":227,"./object":231,"./support":245}],227:[function(e,t){"use strict";function r(e){return new i.Promise(function(t,r){var n=e.decompressed.getContentWorker().pipe(new s);n.on("error",function(e){r(e)}).on("end",function(){n.streamInfo.crc32!==e.decompressed.crc32?r(new Error("Corrupted zip : CRC32 mismatch")):t()}).resume()})}var n=e("./utils"),i=e("./external"),a=e("./utf8"),n=e("./utils"),o=e("./zipEntries"),s=e("./stream/Crc32Probe"),l=e("./nodejsUtils");t.exports=function(e,t){var s=this;return t=n.extend(t||{},{base64:!1,checkCRC32:!1,optimizedBinaryString:!1,createFolders:!1,decodeFileName:a.utf8decode}),l.isNode&&l.isStream(e)?i.Promise.reject(new Error("JSZip can't accept a stream when loading a zip file.")):n.prepareContent("the loaded zip file",e,!0,t.optimizedBinaryString,t.base64).then(function(e){var r=new o(t);return r.load(e),r}).then(function(e){var n=[i.Promise.resolve(e)],a=e.files;if(t.checkCRC32)for(var o=0;o<a.length;o++)n.push(r(a[o]));return i.Promise.all(n)}).then(function(e){for(var r=e.shift(),n=r.files,i=0;i<n.length;i++){var a=n[i];s.file(a.fileNameStr,a.decompressed,{binary:!0,optimizedBinaryString:!0,date:a.date,dir:a.dir,comment:a.fileCommentStr.length?a.fileCommentStr:null,unixPermissions:a.unixPermissions,dosPermissions:a.dosPermissions,createFolders:t.createFolders})}return r.zipComment.length&&(s.comment=r.zipComment),s})}},{"./external":224,"./nodejsUtils":230,"./stream/Crc32Probe":240,"./utf8":246,"./utils":247,"./zipEntries":248}],228:[function(e,t){"use strict";function r(e,t){i.call(this,"Nodejs stream input adapter for "+e),this._upstreamEnded=!1,this._bindStream(t)}var n=e("../utils"),i=e("../stream/GenericWorker");n.inherits(r,i),r.prototype._bindStream=function(e){var t=this;this._stream=e,e.pause(),e.on("data",function(e){t.push({data:e,meta:{percent:0}})}).on("error",function(e){t.isPaused?this.generatedError=e:t.error(e)}).on("end",function(){t.isPaused?t._upstreamEnded=!0:t.end()})},r.prototype.pause=function(){return i.prototype.pause.call(this)?(this._stream.pause(),!0):!1},r.prototype.resume=function(){return i.prototype.resume.call(this)?(this._upstreamEnded?this.end():this._stream.resume(),!0):!1},t.exports=r},{"../stream/GenericWorker":243,"../utils":247}],229:[function(e,t){"use strict";function r(e,t,r){n.call(this,t),this._helper=e;var i=this;e.on("data",function(e,t){i.push(e)||i._helper.pause(),r&&r(t)}).on("error",function(e){i.emit("error",e)}).on("end",function(){i.push(null)})}var n=e("readable-stream").Readable,i=e("util");i.inherits(r,n),r.prototype._read=function(){this._helper.resume()},t.exports=r},{"readable-stream":257,util:289}],230:[function(e,t){(function(e){"use strict";t.exports={isNode:"undefined"!=typeof e,newBuffer:function(t,r){return new e(t,r) 6 },isBuffer:function(t){return e.isBuffer(t)},isStream:function(e){return e&&"function"==typeof e.on&&"function"==typeof e.pause&&"function"==typeof e.resume}}}).call(this,e("buffer").Buffer)},{buffer:41}],231:[function(e,t){"use strict";function r(e){return"[object RegExp]"===Object.prototype.toString.call(e)}var n=e("./utils"),i=e("./stream/GenericWorker"),a=e("./defaults"),o=e("./compressedObject"),s=e("./zipObject"),l=e("./nodejsUtils"),u=e("./nodejs/NodejsStreamInputAdapter"),c=function(e,t,r){var c,p=n.getTypeOf(t);r=n.extend(r||{},a),r.date=r.date||new Date,null!==r.compression&&(r.compression=r.compression.toUpperCase()),"string"==typeof r.unixPermissions&&(r.unixPermissions=parseInt(r.unixPermissions,8)),r.unixPermissions&&16384&r.unixPermissions&&(r.dir=!0),r.dosPermissions&&16&r.dosPermissions&&(r.dir=!0),r.dir&&(e=h(e)),r.createFolders&&(c=f(e))&&d.call(this,c,!0);var m="string"===p&&r.binary===!1&&r.base64===!1;r.binary=!m;var _=t instanceof o&&0===t.uncompressedSize;(_||r.dir||!t||0===t.length)&&(r.base64=!1,r.binary=!0,t="",r.compression="STORE",p="string");var g=null;g=t instanceof o||t instanceof i?t:l.isNode&&l.isStream(t)?new u(e,t):n.prepareContent(e,t,r.binary,r.optimizedBinaryString,r.base64);var v=new s(e,g,r);this.files[e]=v},f=function(e){"/"===e.slice(-1)&&(e=e.substring(0,e.length-1));var t=e.lastIndexOf("/");return t>0?e.substring(0,t):""},h=function(e){return"/"!==e.slice(-1)&&(e+="/"),e},d=function(e,t){return t="undefined"!=typeof t?t:a.createFolders,e=h(e),this.files[e]||c.call(this,e,null,{dir:!0,createFolders:t}),this.files[e]},p={load:function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},forEach:function(e){var t,r,n;for(t in this.files)this.files.hasOwnProperty(t)&&(n=this.files[t],r=t.slice(this.root.length,t.length),r&&t.slice(0,this.root.length)===this.root&&e(r,n))},filter:function(e){var t=[];return this.forEach(function(r,n){e(r,n)&&t.push(n)}),t},file:function(e,t,n){if(1===arguments.length){if(r(e)){var i=e;return this.filter(function(e,t){return!t.dir&&i.test(e)})}var a=this.files[this.root+e];return a&&!a.dir?a:null}return e=this.root+e,c.call(this,e,t,n),this},folder:function(e){if(!e)return this;if(r(e))return this.filter(function(t,r){return r.dir&&e.test(t)});var t=this.root+e,n=d.call(this,t),i=this.clone();return i.root=n.name,i}};t.exports=p},{"./compressedObject":220,"./defaults":223,"./nodejs/NodejsStreamInputAdapter":228,"./nodejsUtils":230,"./stream/GenericWorker":243,"./utils":247,"./zipObject":250}],232:[function(e,t){"use strict";function r(e){n.call(this,e);for(var t=0;t<this.data.length;t++)e[t]=255&e[t]}var n=e("./DataReader"),i=e("../utils");i.inherits(r,n),r.prototype.byteAt=function(e){return this.data[this.zero+e]},r.prototype.lastIndexOfSignature=function(e){for(var t=e.charCodeAt(0),r=e.charCodeAt(1),n=e.charCodeAt(2),i=e.charCodeAt(3),a=this.length-4;a>=0;--a)if(this.data[a]===t&&this.data[a+1]===r&&this.data[a+2]===n&&this.data[a+3]===i)return a-this.zero;return-1},r.prototype.readAndCheckSignature=function(e){var t=e.charCodeAt(0),r=e.charCodeAt(1),n=e.charCodeAt(2),i=e.charCodeAt(3),a=this.readData(4);return t===a[0]&&r===a[1]&&n===a[2]&&i===a[3]},r.prototype.readData=function(e){if(this.checkOffset(e),0===e)return[];var t=this.data.slice(this.zero+this.index,this.zero+this.index+e);return this.index+=e,t},t.exports=r},{"../utils":247,"./DataReader":233}],233:[function(e,t){"use strict";function r(e){this.data=e,this.length=e.length,this.index=0,this.zero=0}var n=e("../utils");r.prototype={checkOffset:function(e){this.checkIndex(this.index+e)},checkIndex:function(e){if(this.length<this.zero+e||0>e)throw new Error("End of data reached (data length = "+this.length+", asked index = "+e+"). Corrupted zip ?")},setIndex:function(e){this.checkIndex(e),this.index=e},skip:function(e){this.setIndex(this.index+e)},byteAt:function(){},readInt:function(e){var t,r=0;for(this.checkOffset(e),t=this.index+e-1;t>=this.index;t--)r=(r<<8)+this.byteAt(t);return this.index+=e,r},readString:function(e){return n.transformTo("string",this.readData(e))},readData:function(){},lastIndexOfSignature:function(){},readAndCheckSignature:function(){},readDate:function(){var e=this.readInt(4);return new Date(Date.UTC((e>>25&127)+1980,(e>>21&15)-1,e>>16&31,e>>11&31,e>>5&63,(31&e)<<1))}},t.exports=r},{"../utils":247}],234:[function(e,t){"use strict";function r(e){n.call(this,e)}var n=e("./Uint8ArrayReader"),i=e("../utils");i.inherits(r,n),r.prototype.readData=function(e){this.checkOffset(e);var t=this.data.slice(this.zero+this.index,this.zero+this.index+e);return this.index+=e,t},t.exports=r},{"../utils":247,"./Uint8ArrayReader":236}],235:[function(e,t){"use strict";function r(e){n.call(this,e)}var n=e("./DataReader"),i=e("../utils");i.inherits(r,n),r.prototype.byteAt=function(e){return this.data.charCodeAt(this.zero+e)},r.prototype.lastIndexOfSignature=function(e){return this.data.lastIndexOf(e)-this.zero},r.prototype.readAndCheckSignature=function(e){var t=this.readData(4);return e===t},r.prototype.readData=function(e){this.checkOffset(e);var t=this.data.slice(this.zero+this.index,this.zero+this.index+e);return this.index+=e,t},t.exports=r},{"../utils":247,"./DataReader":233}],236:[function(e,t){"use strict";function r(e){n.call(this,e)}var n=e("./ArrayReader"),i=e("../utils");i.inherits(r,n),r.prototype.readData=function(e){if(this.checkOffset(e),0===e)return new Uint8Array(0);var t=this.data.subarray(this.zero+this.index,this.zero+this.index+e);return this.index+=e,t},t.exports=r},{"../utils":247,"./ArrayReader":232}],237:[function(e,t){"use strict";var r=e("../utils"),n=e("../support"),i=e("./ArrayReader"),a=e("./StringReader"),o=e("./NodeBufferReader"),s=e("./Uint8ArrayReader");t.exports=function(e){var t=r.getTypeOf(e);return r.checkSupport(t),"string"!==t||n.uint8array?"nodebuffer"===t?new o(e):n.uint8array?new s(r.transformTo("uint8array",e)):new i(r.transformTo("array",e)):new a(e)}},{"../support":245,"../utils":247,"./ArrayReader":232,"./NodeBufferReader":234,"./StringReader":235,"./Uint8ArrayReader":236}],238:[function(e,t,r){"use strict";r.LOCAL_FILE_HEADER="PK",r.CENTRAL_FILE_HEADER="PK",r.CENTRAL_DIRECTORY_END="PK",r.ZIP64_CENTRAL_DIRECTORY_LOCATOR="PK",r.ZIP64_CENTRAL_DIRECTORY_END="PK",r.DATA_DESCRIPTOR="PK\b"},{}],239:[function(e,t){"use strict";function r(e){n.call(this,"ConvertWorker to "+e),this.destType=e}var n=e("./GenericWorker"),i=e("../utils");i.inherits(r,n),r.prototype.processChunk=function(e){this.push({data:i.transformTo(this.destType,e.data),meta:e.meta})},t.exports=r},{"../utils":247,"./GenericWorker":243}],240:[function(e,t){"use strict";function r(){n.call(this,"Crc32Probe")}var n=e("./GenericWorker"),i=e("../crc32"),a=e("../utils");a.inherits(r,n),r.prototype.processChunk=function(e){this.streamInfo.crc32=i(e.data,this.streamInfo.crc32||0),this.push(e)},t.exports=r},{"../crc32":222,"../utils":247,"./GenericWorker":243}],241:[function(e,t){"use strict";function r(e){i.call(this,"DataLengthProbe for "+e),this.propName=e,this.withStreamInfo(e,0)}var n=e("../utils"),i=e("./GenericWorker");n.inherits(r,i),r.prototype.processChunk=function(e){if(e){var t=this.streamInfo[this.propName]||0;this.streamInfo[this.propName]=t+e.data.length}i.prototype.processChunk.call(this,e)},t.exports=r},{"../utils":247,"./GenericWorker":243}],242:[function(e,t){"use strict";function r(e){i.call(this,"DataWorker");var t=this;this.dataIsReady=!1,this.index=0,this.max=0,this.data=null,this.type="",this._tickScheduled=!1,e.then(function(e){t.dataIsReady=!0,t.data=e,t.max=e&&e.length||0,t.type=n.getTypeOf(e),t.isPaused||t._tickAndRepeat()},function(e){t.error(e)})}var n=e("../utils"),i=e("./GenericWorker"),a=16384;n.inherits(r,i),r.prototype.cleanUp=function(){i.prototype.cleanUp.call(this),this.data=null},r.prototype.resume=function(){return i.prototype.resume.call(this)?(!this._tickScheduled&&this.dataIsReady&&(this._tickScheduled=!0,n.delay(this._tickAndRepeat,[],this)),!0):!1},r.prototype._tickAndRepeat=function(){this._tickScheduled=!1,this.isPaused||this.isFinished||(this._tick(),this.isFinished||(n.delay(this._tickAndRepeat,[],this),this._tickScheduled=!0))},r.prototype._tick=function(){if(this.isPaused||this.isFinished)return!1;var e=a,t=null,r=Math.min(this.max,this.index+e);if(this.index>=this.max)return this.end();switch(this.type){case"string":t=this.data.substring(this.index,r);break;case"uint8array":t=this.data.subarray(this.index,r);break;case"array":case"nodebuffer":t=this.data.slice(this.index,r)}return this.index=r,this.push({data:t,meta:{percent:this.max?this.index/this.max*100:0}})},t.exports=r},{"../utils":247,"./GenericWorker":243}],243:[function(e,t){"use strict";function r(e){this.name=e||"default",this.streamInfo={},this.generatedError=null,this.extraStreamInfo={},this.isPaused=!0,this.isFinished=!1,this.isLocked=!1,this._listeners={data:[],end:[],error:[]},this.previous=null}r.prototype={push:function(e){this.emit("data",e)},end:function(){if(this.isFinished)return!1;this.flush();try{this.emit("end"),this.cleanUp(),this.isFinished=!0}catch(e){this.emit("error",e)}return!0},error:function(e){return this.isFinished?!1:(this.isPaused?this.generatedError=e:(this.isFinished=!0,this.emit("error",e),this.previous&&this.previous.error(e),this.cleanUp()),!0)},on:function(e,t){return this._listeners[e].push(t),this},cleanUp:function(){this.streamInfo=this.generatedError=this.extraStreamInfo=null,this._listeners=[]},emit:function(e,t){if(this._listeners[e])for(var r=0;r<this._listeners[e].length;r++)this._listeners[e][r].call(this,t)},pipe:function(e){return e.registerPrevious(this)},registerPrevious:function(e){if(this.isLocked)throw new Error("The stream '"+this+"' has already been used.");this.streamInfo=e.streamInfo,this.mergeStreamInfo(),this.previous=e;var t=this;return e.on("data",function(e){t.processChunk(e)}),e.on("end",function(){t.end()}),e.on("error",function(e){t.error(e)}),this},pause:function(){return this.isPaused||this.isFinished?!1:(this.isPaused=!0,this.previous&&this.previous.pause(),!0)},resume:function(){if(!this.isPaused||this.isFinished)return!1;this.isPaused=!1;var e=!1;return this.generatedError&&(this.error(this.generatedError),e=!0),this.previous&&this.previous.resume(),!e},flush:function(){},processChunk:function(e){this.push(e)},withStreamInfo:function(e,t){return this.extraStreamInfo[e]=t,this.mergeStreamInfo(),this},mergeStreamInfo:function(){for(var e in this.extraStreamInfo)this.extraStreamInfo.hasOwnProperty(e)&&(this.streamInfo[e]=this.extraStreamInfo[e])},lock:function(){if(this.isLocked)throw new Error("The stream '"+this+"' has already been used.");this.isLocked=!0,this.previous&&this.previous.lock()},toString:function(){var e="Worker "+this.name;return this.previous?this.previous+" -> "+e:e}},t.exports=r},{}],244:[function(e,t){(function(r){"use strict";function n(e,t,r){switch(e){case"blob":return s.newBlob(s.transformTo("arraybuffer",t),r);case"base64":return c.encode(t);default:return s.transformTo(e,t)}}function i(e,t){var n,i=0,a=null,o=0;for(n=0;n<t.length;n++)o+=t[n].length;switch(e){case"string":return t.join("");case"array":return Array.prototype.concat.apply([],t);case"uint8array":for(a=new Uint8Array(o),n=0;n<t.length;n++)a.set(t[n],i),i+=t[n].length;return a;case"nodebuffer":return r.concat(t);default:throw new Error("concat : unsupported type '"+e+"'")}}function a(e,t){return new h.Promise(function(r,a){var o=[],s=e._internalType,l=e._outputType,u=e._mimeType;e.on("data",function(e,r){o.push(e),t&&t(r)}).on("error",function(e){o=[],a(e)}).on("end",function(){try{var e=n(l,i(s,o),u);r(e)}catch(t){a(t)}o=[]}).resume()})}function o(e,t,r){var n=t;switch(t){case"blob":case"arraybuffer":n="uint8array";break;case"base64":n="string"}try{this._internalType=n,this._outputType=t,this._mimeType=r,s.checkSupport(n),this._worker=e.pipe(new l(n)),e.lock()}catch(i){this._worker=new u("error"),this._worker.error(i)}}var s=e("../utils"),l=e("./ConvertWorker"),u=e("./GenericWorker"),c=e("../base64"),f=e("../nodejs/NodejsStreamOutputAdapter"),h=e("../external");o.prototype={accumulate:function(e){return a(this,e)},on:function(e,t){var r=this;return"data"===e?this._worker.on(e,function(e){t.call(r,e.data,e.meta)}):this._worker.on(e,function(){s.delay(t,arguments,r)}),this},resume:function(){return s.delay(this._worker.resume,[],this._worker),this},pause:function(){return this._worker.pause(),this},toNodejsStream:function(e){if(s.checkSupport("nodestream"),"nodebuffer"!==this._outputType)throw new Error(this._outputType+" is not supported by this method");return new f(this,{objectMode:"nodebuffer"!==this._outputType},e)}},t.exports=o}).call(this,e("buffer").Buffer)},{"../base64":219,"../external":224,"../nodejs/NodejsStreamOutputAdapter":229,"../utils":247,"./ConvertWorker":239,"./GenericWorker":243,buffer:41}],245:[function(e,t,r){(function(t){"use strict";if(r.base64=!0,r.array=!0,r.string=!0,r.arraybuffer="undefined"!=typeof ArrayBuffer&&"undefined"!=typeof Uint8Array,r.nodebuffer="undefined"!=typeof t,r.uint8array="undefined"!=typeof Uint8Array,"undefined"==typeof ArrayBuffer)r.blob=!1;else{var n=new ArrayBuffer(0);try{r.blob=0===new Blob([n],{type:"application/zip"}).size}catch(i){try{var a=window.BlobBuilder||window.WebKitBlobBuilder||window.MozBlobBuilder||window.MSBlobBuilder,o=new a;o.append(n),r.blob=0===o.getBlob("application/zip").size}catch(i){r.blob=!1}}}r.nodestream=!!e("./nodejs/NodejsStreamOutputAdapter").prototype}).call(this,e("buffer").Buffer)},{"./nodejs/NodejsStreamOutputAdapter":229,buffer:41}],246:[function(e,t,r){"use strict";function n(){l.call(this,"utf-8 decode"),this.leftOver=null}function i(){l.call(this,"utf-8 encode")}for(var a=e("./utils"),o=e("./support"),s=e("./nodejsUtils"),l=e("./stream/GenericWorker"),u=new Array(256),c=0;256>c;c++)u[c]=c>=252?6:c>=248?5:c>=240?4:c>=224?3:c>=192?2:1;u[254]=u[254]=1;var f=function(e){var t,r,n,i,a,s=e.length,l=0;for(i=0;s>i;i++)r=e.charCodeAt(i),55296===(64512&r)&&s>i+1&&(n=e.charCodeAt(i+1),56320===(64512&n)&&(r=65536+(r-55296<<10)+(n-56320),i++)),l+=128>r?1:2048>r?2:65536>r?3:4;for(t=o.uint8array?new Uint8Array(l):new Array(l),a=0,i=0;l>a;i++)r=e.charCodeAt(i),55296===(64512&r)&&s>i+1&&(n=e.charCodeAt(i+1),56320===(64512&n)&&(r=65536+(r-55296<<10)+(n-56320),i++)),128>r?t[a++]=r:2048>r?(t[a++]=192|r>>>6,t[a++]=128|63&r):65536>r?(t[a++]=224|r>>>12,t[a++]=128|r>>>6&63,t[a++]=128|63&r):(t[a++]=240|r>>>18,t[a++]=128|r>>>12&63,t[a++]=128|r>>>6&63,t[a++]=128|63&r);return t},h=function(e,t){var r;for(t=t||e.length,t>e.length&&(t=e.length),r=t-1;r>=0&&128===(192&e[r]);)r--;return 0>r?t:0===r?t:r+u[e[r]]>t?r:t},d=function(e){var t,r,n,i,o=e.length,s=new Array(2*o);for(r=0,t=0;o>t;)if(n=e[t++],128>n)s[r++]=n;else if(i=u[n],i>4)s[r++]=65533,t+=i-1;else{for(n&=2===i?31:3===i?15:7;i>1&&o>t;)n=n<<6|63&e[t++],i--;i>1?s[r++]=65533:65536>n?s[r++]=n:(n-=65536,s[r++]=55296|n>>10&1023,s[r++]=56320|1023&n)}return s.length!==r&&(s.subarray?s=s.subarray(0,r):s.length=r),a.applyFromCharCode(s)};r.utf8encode=function(e){return o.nodebuffer?s.newBuffer(e,"utf-8"):f(e)},r.utf8decode=function(e){return o.nodebuffer?a.transformTo("nodebuffer",e).toString("utf-8"):(e=a.transformTo(o.uint8array?"uint8array":"array",e),d(e))},a.inherits(n,l),n.prototype.processChunk=function(e){var t=a.transformTo(o.uint8array?"uint8array":"array",e.data);if(this.leftOver&&this.leftOver.length){if(o.uint8array){var n=t;t=new Uint8Array(n.length+this.leftOver.length),t.set(this.leftOver,0),t.set(n,this.leftOver.length)}else t=this.leftOver.concat(t);this.leftOver=null}var i=h(t),s=t;i!==t.length&&(o.uint8array?(s=t.subarray(0,i),this.leftOver=t.subarray(i,t.length)):(s=t.slice(0,i),this.leftOver=t.slice(i,t.length))),this.push({data:r.utf8decode(s),meta:e.meta})},n.prototype.flush=function(){this.leftOver&&this.leftOver.length&&(this.push({data:r.utf8decode(this.leftOver),meta:{}}),this.leftOver=null)},r.Utf8DecodeWorker=n,a.inherits(i,l),i.prototype.processChunk=function(e){this.push({data:r.utf8encode(e.data),meta:e.meta})},r.Utf8EncodeWorker=i},{"./nodejsUtils":230,"./stream/GenericWorker":243,"./support":245,"./utils":247}],247:[function(e,t,r){"use strict";function n(e){var t=null;return t=l.uint8array?new Uint8Array(e.length):new Array(e.length),a(e,t)}function i(e){return e}function a(e,t){for(var r=0;r<e.length;++r)t[r]=255&e.charCodeAt(r);return t}function o(e){var t=65536,n=r.getTypeOf(e),i=!0;if("uint8array"===n?i=d.applyCanBeUsed.uint8array:"nodebuffer"===n&&(i=d.applyCanBeUsed.nodebuffer),i)for(;t>1;)try{return d.stringifyByChunk(e,n,t)}catch(a){t=Math.floor(t/2)}return d.stringifyByChar(e)}function s(e,t){for(var r=0;r<e.length;r++)t[r]=e[r];return t}var l=e("./support"),u=e("./base64"),c=e("./nodejsUtils"),f=e("asap"),h=e("./external");r.newBlob=function(e,t){r.checkSupport("blob");try{return new Blob([e],{type:t})}catch(n){try{var i=window.BlobBuilder||window.WebKitBlobBuilder||window.MozBlobBuilder||window.MSBlobBuilder,a=new i;return a.append(e),a.getBlob(t)}catch(n){throw new Error("Bug : can't construct the Blob.")}}};var d={stringifyByChunk:function(e,t,r){var n=[],i=0,a=e.length;if(r>=a)return String.fromCharCode.apply(null,e);for(;a>i;)n.push("array"===t||"nodebuffer"===t?String.fromCharCode.apply(null,e.slice(i,Math.min(i+r,a))):String.fromCharCode.apply(null,e.subarray(i,Math.min(i+r,a)))),i+=r;return n.join("")},stringifyByChar:function(e){for(var t="",r=0;r<e.length;r++)t+=String.fromCharCode(e[r]);return t},applyCanBeUsed:{uint8array:function(){try{return l.uint8array&&1===String.fromCharCode.apply(null,new Uint8Array(1)).length}catch(e){return!1}}(),nodebuffer:function(){try{return l.nodebuffer&&1===String.fromCharCode.apply(null,c.newBuffer(1)).length}catch(e){return!1}}()}};r.applyFromCharCode=o;var p={};p.string={string:i,array:function(e){return a(e,new Array(e.length))},arraybuffer:function(e){return p.string.uint8array(e).buffer},uint8array:function(e){return a(e,new Uint8Array(e.length))},nodebuffer:function(e){return a(e,c.newBuffer(e.length))}},p.array={string:o,array:i,arraybuffer:function(e){return new Uint8Array(e).buffer},uint8array:function(e){return new Uint8Array(e)},nodebuffer:function(e){return c.newBuffer(e)}},p.arraybuffer={string:function(e){return o(new Uint8Array(e))},array:function(e){return s(new Uint8Array(e),new Array(e.byteLength))},arraybuffer:i,uint8array:function(e){return new Uint8Array(e)},nodebuffer:function(e){return c.newBuffer(new Uint8Array(e))}},p.uint8array={string:o,array:function(e){return s(e,new Array(e.length))},arraybuffer:function(e){return e.buffer},uint8array:i,nodebuffer:function(e){return c.newBuffer(e)}},p.nodebuffer={string:o,array:function(e){return s(e,new Array(e.length))},arraybuffer:function(e){return p.nodebuffer.uint8array(e).buffer},uint8array:function(e){return s(e,new Uint8Array(e.length))},nodebuffer:i},r.transformTo=function(e,t){if(t||(t=""),!e)return t;r.checkSupport(e);var n=r.getTypeOf(t),i=p[n][e](t);return i},r.getTypeOf=function(e){return"string"==typeof e?"string":"[object Array]"===Object.prototype.toString.call(e)?"array":l.nodebuffer&&c.isBuffer(e)?"nodebuffer":l.uint8array&&e instanceof Uint8Array?"uint8array":l.arraybuffer&&e instanceof ArrayBuffer?"arraybuffer":void 0},r.checkSupport=function(e){var t=l[e.toLowerCase()];if(!t)throw new Error(e+" is not supported by this platform")},r.MAX_VALUE_16BITS=65535,r.MAX_VALUE_32BITS=-1,r.pretty=function(e){var t,r,n="";for(r=0;r<(e||"").length;r++)t=e.charCodeAt(r),n+="\\x"+(16>t?"0":"")+t.toString(16).toUpperCase();return n},r.delay=function(e,t,r){f(function(){e.apply(r||null,t||[])})},r.inherits=function(e,t){var r=function(){};r.prototype=t.prototype,e.prototype=new r},r.extend=function(){var e,t,r={};for(e=0;e<arguments.length;e++)for(t in arguments[e])arguments[e].hasOwnProperty(t)&&"undefined"==typeof r[t]&&(r[t]=arguments[e][t]);return r},r.prepareContent=function(e,t,i,a,o){var s=null;return s=l.blob&&t instanceof Blob&&"undefined"!=typeof FileReader?new h.Promise(function(e,r){var n=new FileReader;n.onload=function(t){e(t.target.result)},n.onerror=function(e){r(e.target.error)},n.readAsArrayBuffer(t)}):h.Promise.resolve(t),s.then(function(t){var s=r.getTypeOf(t);return s?("arraybuffer"===s?t=r.transformTo("uint8array",t):"string"===s&&(o?t=u.decode(t):i&&a!==!0&&(t=n(t))),t):h.Promise.reject(new Error("The data of '"+e+"' is in an unsupported format !"))})}},{"./base64":219,"./external":224,"./nodejsUtils":230,"./support":245,asap:1}],248:[function(e,t){"use strict";function r(e){this.files=[],this.loadOptions=e}var n=e("./reader/readerFor"),i=e("./utils"),a=e("./signature"),o=e("./zipEntry"),s=(e("./utf8"),e("./support"));r.prototype={checkSignature:function(e){if(!this.reader.readAndCheckSignature(e)){this.reader.index-=4;var t=this.reader.readString(4);throw new Error("Corrupted zip or bug : unexpected signature ("+i.pretty(t)+", expected "+i.pretty(e)+")")}},isSignature:function(e,t){var r=this.reader.index;this.reader.setIndex(e);var n=this.reader.readString(4),i=n===t;return this.reader.setIndex(r),i},readBlockEndOfCentral:function(){this.diskNumber=this.reader.readInt(2),this.diskWithCentralDirStart=this.reader.readInt(2),this.centralDirRecordsOnThisDisk=this.reader.readInt(2),this.centralDirRecords=this.reader.readInt(2),this.centralDirSize=this.reader.readInt(4),this.centralDirOffset=this.reader.readInt(4),this.zipCommentLength=this.reader.readInt(2);var e=this.reader.readData(this.zipCommentLength),t=s.uint8array?"uint8array":"array",r=i.transformTo(t,e);this.zipComment=this.loadOptions.decodeFileName(r)},readBlockZip64EndOfCentral:function(){this.zip64EndOfCentralSize=this.reader.readInt(8),this.reader.skip(4),this.diskNumber=this.reader.readInt(4),this.diskWithCentralDirStart=this.reader.readInt(4),this.centralDirRecordsOnThisDisk=this.reader.readInt(8),this.centralDirRecords=this.reader.readInt(8),this.centralDirSize=this.reader.readInt(8),this.centralDirOffset=this.reader.readInt(8),this.zip64ExtensibleData={};for(var e,t,r,n=this.zip64EndOfCentralSize-44,i=0;n>i;)e=this.reader.readInt(2),t=this.reader.readInt(4),r=this.reader.readData(t),this.zip64ExtensibleData[e]={id:e,length:t,value:r}},readBlockZip64EndOfCentralLocator:function(){if(this.diskWithZip64CentralDirStart=this.reader.readInt(4),this.relativeOffsetEndOfZip64CentralDir=this.reader.readInt(8),this.disksCount=this.reader.readInt(4),this.disksCount>1)throw new Error("Multi-volumes zip are not supported")},readLocalFiles:function(){var e,t;for(e=0;e<this.files.length;e++)t=this.files[e],this.reader.setIndex(t.localHeaderOffset),this.checkSignature(a.LOCAL_FILE_HEADER),t.readLocalPart(this.reader),t.handleUTF8(),t.processAttributes()},readCentralDir:function(){var e;for(this.reader.setIndex(this.centralDirOffset);this.reader.readAndCheckSignature(a.CENTRAL_FILE_HEADER);)e=new o({zip64:this.zip64},this.loadOptions),e.readCentralPart(this.reader),this.files.push(e);if(this.centralDirRecords!==this.files.length&&0!==this.centralDirRecords&&0===this.files.length)throw new Error("Corrupted zip or bug: expected "+this.centralDirRecords+" records in central dir, got "+this.files.length)},readEndOfCentral:function(){var e=this.reader.lastIndexOfSignature(a.CENTRAL_DIRECTORY_END);if(0>e){var t=!this.isSignature(0,a.LOCAL_FILE_HEADER);throw new Error(t?"Can't find end of central directory : is this a zip file ? If it is, see http://stuk.github.io/jszip/documentation/howto/read_zip.html":"Corrupted zip : can't find end of central directory")}this.reader.setIndex(e);var r=e;if(this.checkSignature(a.CENTRAL_DIRECTORY_END),this.readBlockEndOfCentral(),this.diskNumber===i.MAX_VALUE_16BITS||this.diskWithCentralDirStart===i.MAX_VALUE_16BITS||this.centralDirRecordsOnThisDisk===i.MAX_VALUE_16BITS||this.centralDirRecords===i.MAX_VALUE_16BITS||this.centralDirSize===i.MAX_VALUE_32BITS||this.centralDirOffset===i.MAX_VALUE_32BITS){if(this.zip64=!0,e=this.reader.lastIndexOfSignature(a.ZIP64_CENTRAL_DIRECTORY_LOCATOR),0>e)throw new Error("Corrupted zip : can't find the ZIP64 end of central directory locator");if(this.reader.setIndex(e),this.checkSignature(a.ZIP64_CENTRAL_DIRECTORY_LOCATOR),this.readBlockZip64EndOfCentralLocator(),!this.isSignature(this.relativeOffsetEndOfZip64CentralDir,a.ZIP64_CENTRAL_DIRECTORY_END)&&(this.relativeOffsetEndOfZip64CentralDir=this.reader.lastIndexOfSignature(a.ZIP64_CENTRAL_DIRECTORY_END),this.relativeOffsetEndOfZip64CentralDir<0))throw new Error("Corrupted zip : can't find the ZIP64 end of central directory");this.reader.setIndex(this.relativeOffsetEndOfZip64CentralDir),this.checkSignature(a.ZIP64_CENTRAL_DIRECTORY_END),this.readBlockZip64EndOfCentral()}var n=this.centralDirOffset+this.centralDirSize;this.zip64&&(n+=20,n+=12+this.zip64EndOfCentralSize);var o=r-n;if(o>0)this.isSignature(r,a.CENTRAL_FILE_HEADER)||(this.reader.zero=o);else if(0>o)throw new Error("Corrupted zip: missing "+Math.abs(o)+" bytes.")},prepareReader:function(e){this.reader=n(e)},load:function(e){this.prepareReader(e),this.readEndOfCentral(),this.readCentralDir(),this.readLocalFiles()}},t.exports=r},{"./reader/readerFor":237,"./signature":238,"./support":245,"./utf8":246,"./utils":247,"./zipEntry":249}],249:[function(e,t){"use strict";function r(e,t){this.options=e,this.loadOptions=t}var n=e("./reader/readerFor"),i=e("./utils"),a=e("./compressedObject"),o=e("./crc32"),s=e("./utf8"),l=e("./compressions"),u=e("./support"),c=0,f=3,h=function(e){for(var t in l)if(l.hasOwnProperty(t)&&l[t].magic===e)return l[t];return null};r.prototype={isEncrypted:function(){return 1===(1&this.bitFlag)},useUTF8:function(){return 2048===(2048&this.bitFlag)},readLocalPart:function(e){var t,r;if(e.skip(22),this.fileNameLength=e.readInt(2),r=e.readInt(2),this.fileName=e.readData(this.fileNameLength),e.skip(r),-1===this.compressedSize||-1===this.uncompressedSize)throw new Error("Bug or corrupted zip : didn't get enough informations from the central directory (compressedSize === -1 || uncompressedSize === -1)");if(t=h(this.compressionMethod),null===t)throw new Error("Corrupted zip : compression "+i.pretty(this.compressionMethod)+" unknown (inner file : "+i.transformTo("string",this.fileName)+")");this.decompressed=new a(this.compressedSize,this.uncompressedSize,this.crc32,t,e.readData(this.compressedSize))},readCentralPart:function(e){this.versionMadeBy=e.readInt(2),e.skip(2),this.bitFlag=e.readInt(2),this.compressionMethod=e.readString(2),this.date=e.readDate(),this.crc32=e.readInt(4),this.compressedSize=e.readInt(4),this.uncompressedSize=e.readInt(4);var t=e.readInt(2);if(this.extraFieldsLength=e.readInt(2),this.fileCommentLength=e.readInt(2),this.diskNumberStart=e.readInt(2),this.internalFileAttributes=e.readInt(2),this.externalFileAttributes=e.readInt(4),this.localHeaderOffset=e.readInt(4),this.isEncrypted())throw new Error("Encrypted zip are not supported");e.skip(t),this.readExtraFields(e),this.parseZIP64ExtraField(e),this.fileComment=e.readData(this.fileCommentLength)},processAttributes:function(){this.unixPermissions=null,this.dosPermissions=null;var e=this.versionMadeBy>>8;this.dir=16&this.externalFileAttributes?!0:!1,e===c&&(this.dosPermissions=63&this.externalFileAttributes),e===f&&(this.unixPermissions=this.externalFileAttributes>>16&65535),this.dir||"/"!==this.fileNameStr.slice(-1)||(this.dir=!0)},parseZIP64ExtraField:function(){if(this.extraFields[1]){var e=n(this.extraFields[1].value);this.uncompressedSize===i.MAX_VALUE_32BITS&&(this.uncompressedSize=e.readInt(8)),this.compressedSize===i.MAX_VALUE_32BITS&&(this.compressedSize=e.readInt(8)),this.localHeaderOffset===i.MAX_VALUE_32BITS&&(this.localHeaderOffset=e.readInt(8)),this.diskNumberStart===i.MAX_VALUE_32BITS&&(this.diskNumberStart=e.readInt(4))}},readExtraFields:function(e){var t,r,n,i=e.index+this.extraFieldsLength;for(this.extraFields||(this.extraFields={});e.index<i;)t=e.readInt(2),r=e.readInt(2),n=e.readData(r),this.extraFields[t]={id:t,length:r,value:n}},handleUTF8:function(){var e=u.uint8array?"uint8array":"array";if(this.useUTF8())this.fileNameStr=s.utf8decode(this.fileName),this.fileCommentStr=s.utf8decode(this.fileComment);else{var t=this.findExtraFieldUnicodePath();if(null!==t)this.fileNameStr=t;else{var r=i.transformTo(e,this.fileName);this.fileNameStr=this.loadOptions.decodeFileName(r)}var n=this.findExtraFieldUnicodeComment();if(null!==n)this.fileCommentStr=n;else{var a=i.transformTo(e,this.fileComment);this.fileCommentStr=this.loadOptions.decodeFileName(a)}}},findExtraFieldUnicodePath:function(){var e=this.extraFields[28789];if(e){var t=n(e.value);return 1!==t.readInt(1)?null:o(this.fileName)!==t.readInt(4)?null:s.utf8decode(t.readData(e.length-5))}return null},findExtraFieldUnicodeComment:function(){var e=this.extraFields[25461];if(e){var t=n(e.value);return 1!==t.readInt(1)?null:o(this.fileComment)!==t.readInt(4)?null:s.utf8decode(t.readData(e.length-5))}return null}},t.exports=r},{"./compressedObject":220,"./compressions":221,"./crc32":222,"./reader/readerFor":237,"./support":245,"./utf8":246,"./utils":247}],250:[function(e,t){"use strict";var r=e("./stream/StreamHelper"),n=e("./stream/DataWorker"),i=e("./utf8"),a=e("./compressedObject"),o=e("./stream/GenericWorker"),s=function(e,t,r){this.name=e,this.dir=r.dir,this.date=r.date,this.comment=r.comment,this.unixPermissions=r.unixPermissions,this.dosPermissions=r.dosPermissions,this._data=t,this._dataBinary=r.binary,this.options={compression:r.compression,compressionOptions:r.compressionOptions}};s.prototype={internalStream:function(e){var t=e.toLowerCase(),n="string"===t||"text"===t;("binarystring"===t||"text"===t)&&(t="string");var a=this._decompressWorker(),o=!this._dataBinary;return o&&!n&&(a=a.pipe(new i.Utf8EncodeWorker)),!o&&n&&(a=a.pipe(new i.Utf8DecodeWorker)),new r(a,t,"")},async:function(e,t){return this.internalStream(e).accumulate(t)},nodeStream:function(e,t){return this.internalStream(e||"nodebuffer").toNodejsStream(t)},_decompressWorker:function(){return this._data instanceof a?this._data.getContentWorker():this._data instanceof o?this._data:new n(this._data)}};for(var l=["asText","asBinary","asNodeBuffer","asUint8Array","asArrayBuffer"],u=function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},c=0;c<l.length;c++)s.prototype[l[c]]=u;t.exports=s},{"./compressedObject":220,"./stream/DataWorker":242,"./stream/GenericWorker":243,"./stream/StreamHelper":244,"./utf8":246}],251:[function(e,t,r){arguments[4][189][0].apply(r,arguments)},{dup:189}],252:[function(e,t){"use strict";function r(e){return this instanceof r?(l.call(this,e),u.call(this,e),e&&e.readable===!1&&(this.readable=!1),e&&e.writable===!1&&(this.writable=!1),this.allowHalfOpen=!0,e&&e.allowHalfOpen===!1&&(this.allowHalfOpen=!1),void this.once("end",n)):new r(e)}function n(){this.allowHalfOpen||this._writableState.ended||o(i,this)}function i(e){e.end()}var a=Object.keys||function(e){var t=[];for(var r in e)t.push(r);return t};t.exports=r;var o=e("process-nextick-args"),s=e("core-util-is");s.inherits=e("inherits");var l=e("./_stream_readable"),u=e("./_stream_writable");s.inherits(r,l);for(var c=a(u.prototype),f=0;f<c.length;f++){var h=c[f];r.prototype[h]||(r.prototype[h]=u.prototype[h])}},{"./_stream_readable":254,"./_stream_writable":256,"core-util-is":164,inherits:187,"process-nextick-args":278}],253:[function(e,t){"use strict";function r(e){return this instanceof r?void n.call(this,e):new r(e)}t.exports=r;var n=e("./_stream_transform"),i=e("core-util-is");i.inherits=e("inherits"),i.inherits(r,n),r.prototype._transform=function(e,t,r){r(null,e)}},{"./_stream_transform":255,"core-util-is":164,inherits:187}],254:[function(e,t){(function(r){"use strict";function n(t,r){N=N||e("./_stream_duplex"),t=t||{},this.objectMode=!!t.objectMode,r instanceof N&&(this.objectMode=this.objectMode||!!t.readableObjectMode);var n=t.highWaterMark,i=this.objectMode?16:16384;this.highWaterMark=n||0===n?n:i,this.highWaterMark=~~this.highWaterMark,this.buffer=[],this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.defaultEncoding=t.defaultEncoding||"utf8",this.ranOut=!1,this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,t.encoding&&(P||(P=e("string_decoder/").StringDecoder),this.decoder=new P(t.encoding),this.encoding=t.encoding) 7 }function i(t){return N=N||e("./_stream_duplex"),this instanceof i?(this._readableState=new n(t,this),this.readable=!0,t&&"function"==typeof t.read&&(this._read=t.read),void R.call(this)):new i(t)}function a(e,t,r,n,i){var a=u(t,r);if(a)e.emit("error",a);else if(null===r)t.reading=!1,c(e,t);else if(t.objectMode||r&&r.length>0)if(t.ended&&!i){var s=new Error("stream.push() after EOF");e.emit("error",s)}else if(t.endEmitted&&i){var s=new Error("stream.unshift() after end event");e.emit("error",s)}else{var l;!t.decoder||i||n||(r=t.decoder.write(r),l=!t.objectMode&&0===r.length),i||(t.reading=!1),l||(t.flowing&&0===t.length&&!t.sync?(e.emit("data",r),e.read(0)):(t.length+=t.objectMode?1:r.length,i?t.buffer.unshift(r):t.buffer.push(r),t.needReadable&&f(e))),d(e,t)}else i||(t.reading=!1);return o(t)}function o(e){return!e.ended&&(e.needReadable||e.length<e.highWaterMark||0===e.length)}function s(e){return e>=L?e=L:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}function l(e,t){return 0===t.length&&t.ended?0:t.objectMode?0===e?0:1:null===e||isNaN(e)?t.flowing&&t.buffer.length?t.buffer[0].length:t.length:0>=e?0:(e>t.highWaterMark&&(t.highWaterMark=s(e)),e>t.length?t.ended?t.length:(t.needReadable=!0,0):e)}function u(e,t){var r=null;return S.isBuffer(t)||"string"==typeof t||null===t||void 0===t||e.objectMode||(r=new TypeError("Invalid non-string/buffer chunk")),r}function c(e,t){if(!t.ended){if(t.decoder){var r=t.decoder.end();r&&r.length&&(t.buffer.push(r),t.length+=t.objectMode?1:r.length)}t.ended=!0,f(e)}}function f(e){var t=e._readableState;t.needReadable=!1,t.emittedReadable||(C("emitReadable",t.flowing),t.emittedReadable=!0,t.sync?T(h,e):h(e))}function h(e){C("emit readable"),e.emit("readable"),y(e)}function d(e,t){t.readingMore||(t.readingMore=!0,T(p,e,t))}function p(e,t){for(var r=t.length;!t.reading&&!t.flowing&&!t.ended&&t.length<t.highWaterMark&&(C("maybeReadMore read 0"),e.read(0),r!==t.length);)r=t.length;t.readingMore=!1}function m(e){return function(){var t=e._readableState;C("pipeOnDrain",t.awaitDrain),t.awaitDrain&&t.awaitDrain--,0===t.awaitDrain&&j(e,"data")&&(t.flowing=!0,y(e))}}function _(e){C("readable nexttick read 0"),e.read(0)}function g(e,t){t.resumeScheduled||(t.resumeScheduled=!0,T(v,e,t))}function v(e,t){t.reading||(C("resume read 0"),e.read(0)),t.resumeScheduled=!1,e.emit("resume"),y(e),t.flowing&&!t.reading&&e.read(0)}function y(e){var t=e._readableState;if(C("flow",t.flowing),t.flowing)do var r=e.read();while(null!==r&&t.flowing)}function b(e,t){var r,n=t.buffer,i=t.length,a=!!t.decoder,o=!!t.objectMode;if(0===n.length)return null;if(0===i)r=null;else if(o)r=n.shift();else if(!e||e>=i)r=a?n.join(""):1===n.length?n[0]:S.concat(n,i),n.length=0;else if(e<n[0].length){var s=n[0];r=s.slice(0,e),n[0]=s.slice(e)}else if(e===n[0].length)r=n.shift();else{r=a?"":new S(e);for(var l=0,u=0,c=n.length;c>u&&e>l;u++){var s=n[0],f=Math.min(e-l,s.length);a?r+=s.slice(0,f):s.copy(r,l,0,f),f<s.length?n[0]=s.slice(f):n.shift(),l+=f}}return r}function x(e){var t=e._readableState;if(t.length>0)throw new Error("endReadable called on non-empty stream");t.endEmitted||(t.ended=!0,T(w,t,e))}function w(e,t){e.endEmitted||0!==e.length||(e.endEmitted=!0,t.readable=!1,t.emit("end"))}function k(e,t){for(var r=0,n=e.length;n>r;r++)t(e[r],r)}function A(e,t){for(var r=0,n=e.length;n>r;r++)if(e[r]===t)return r;return-1}t.exports=i;var T=e("process-nextick-args"),E=e("isarray"),S=e("buffer").Buffer;i.ReadableState=n;var R,j=(e("events"),function(e,t){return e.listeners(t).length});!function(){try{R=e("stream")}catch(t){}finally{R||(R=e("events").EventEmitter)}}();var S=e("buffer").Buffer,M=e("core-util-is");M.inherits=e("inherits");var z=e("util"),C=void 0;C=z&&z.debuglog?z.debuglog("stream"):function(){};var P;M.inherits(i,R);var N,N;i.prototype.push=function(e,t){var r=this._readableState;return r.objectMode||"string"!=typeof e||(t=t||r.defaultEncoding,t!==r.encoding&&(e=new S(e,t),t="")),a(this,r,e,t,!1)},i.prototype.unshift=function(e){var t=this._readableState;return a(this,t,e,"",!0)},i.prototype.isPaused=function(){return this._readableState.flowing===!1},i.prototype.setEncoding=function(t){return P||(P=e("string_decoder/").StringDecoder),this._readableState.decoder=new P(t),this._readableState.encoding=t,this};var L=8388608;i.prototype.read=function(e){C("read",e);var t=this._readableState,r=e;if(("number"!=typeof e||e>0)&&(t.emittedReadable=!1),0===e&&t.needReadable&&(t.length>=t.highWaterMark||t.ended))return C("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?x(this):f(this),null;if(e=l(e,t),0===e&&t.ended)return 0===t.length&&x(this),null;var n=t.needReadable;C("need readable",n),(0===t.length||t.length-e<t.highWaterMark)&&(n=!0,C("length less than watermark",n)),(t.ended||t.reading)&&(n=!1,C("reading or ended",n)),n&&(C("do read"),t.reading=!0,t.sync=!0,0===t.length&&(t.needReadable=!0),this._read(t.highWaterMark),t.sync=!1),n&&!t.reading&&(e=l(r,t));var i;return i=e>0?b(e,t):null,null===i&&(t.needReadable=!0,e=0),t.length-=e,0!==t.length||t.ended||(t.needReadable=!0),r!==e&&t.ended&&0===t.length&&x(this),null!==i&&this.emit("data",i),i},i.prototype._read=function(){this.emit("error",new Error("not implemented"))},i.prototype.pipe=function(e,t){function n(e){C("onunpipe"),e===f&&a()}function i(){C("onend"),e.end()}function a(){C("cleanup"),e.removeListener("close",l),e.removeListener("finish",u),e.removeListener("drain",_),e.removeListener("error",s),e.removeListener("unpipe",n),f.removeListener("end",i),f.removeListener("end",a),f.removeListener("data",o),g=!0,!h.awaitDrain||e._writableState&&!e._writableState.needDrain||_()}function o(t){C("ondata");var r=e.write(t);!1===r&&(1!==h.pipesCount||h.pipes[0]!==e||1!==f.listenerCount("data")||g||(C("false write response, pause",f._readableState.awaitDrain),f._readableState.awaitDrain++),f.pause())}function s(t){C("onerror",t),c(),e.removeListener("error",s),0===j(e,"error")&&e.emit("error",t)}function l(){e.removeListener("finish",u),c()}function u(){C("onfinish"),e.removeListener("close",l),c()}function c(){C("unpipe"),f.unpipe(e)}var f=this,h=this._readableState;switch(h.pipesCount){case 0:h.pipes=e;break;case 1:h.pipes=[h.pipes,e];break;default:h.pipes.push(e)}h.pipesCount+=1,C("pipe count=%d opts=%j",h.pipesCount,t);var d=(!t||t.end!==!1)&&e!==r.stdout&&e!==r.stderr,p=d?i:a;h.endEmitted?T(p):f.once("end",p),e.on("unpipe",n);var _=m(f);e.on("drain",_);var g=!1;return f.on("data",o),e._events&&e._events.error?E(e._events.error)?e._events.error.unshift(s):e._events.error=[s,e._events.error]:e.on("error",s),e.once("close",l),e.once("finish",u),e.emit("pipe",f),h.flowing||(C("pipe resume"),f.resume()),e},i.prototype.unpipe=function(e){var t=this._readableState;if(0===t.pipesCount)return this;if(1===t.pipesCount)return e&&e!==t.pipes?this:(e||(e=t.pipes),t.pipes=null,t.pipesCount=0,t.flowing=!1,e&&e.emit("unpipe",this),this);if(!e){var r=t.pipes,n=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var i=0;n>i;i++)r[i].emit("unpipe",this);return this}var a=A(t.pipes,e);return-1===a?this:(t.pipes.splice(a,1),t.pipesCount-=1,1===t.pipesCount&&(t.pipes=t.pipes[0]),e.emit("unpipe",this),this)},i.prototype.on=function(e,t){var r=R.prototype.on.call(this,e,t);if("data"===e&&!1!==this._readableState.flowing&&this.resume(),"readable"===e&&!this._readableState.endEmitted){var n=this._readableState;n.readableListening||(n.readableListening=!0,n.emittedReadable=!1,n.needReadable=!0,n.reading?n.length&&f(this,n):T(_,this))}return r},i.prototype.addListener=i.prototype.on,i.prototype.resume=function(){var e=this._readableState;return e.flowing||(C("resume"),e.flowing=!0,g(this,e)),this},i.prototype.pause=function(){return C("call pause flowing=%j",this._readableState.flowing),!1!==this._readableState.flowing&&(C("pause"),this._readableState.flowing=!1,this.emit("pause")),this},i.prototype.wrap=function(e){var t=this._readableState,r=!1,n=this;e.on("end",function(){if(C("wrapped end"),t.decoder&&!t.ended){var e=t.decoder.end();e&&e.length&&n.push(e)}n.push(null)}),e.on("data",function(i){if(C("wrapped data"),t.decoder&&(i=t.decoder.write(i)),(!t.objectMode||null!==i&&void 0!==i)&&(t.objectMode||i&&i.length)){var a=n.push(i);a||(r=!0,e.pause())}});for(var i in e)void 0===this[i]&&"function"==typeof e[i]&&(this[i]=function(t){return function(){return e[t].apply(e,arguments)}}(i));var a=["error","close","destroy","pause","resume"];return k(a,function(t){e.on(t,n.emit.bind(n,t))}),n._read=function(t){C("wrapped _read",t),r&&(r=!1,e.resume())},n},i._fromList=b}).call(this,e("_process"))},{"./_stream_duplex":252,_process:279,buffer:41,"core-util-is":164,events:168,inherits:187,isarray:251,"process-nextick-args":278,"string_decoder/":282,util:40}],255:[function(e,t){"use strict";function r(e){this.afterTransform=function(t,r){return n(e,t,r)},this.needTransform=!1,this.transforming=!1,this.writecb=null,this.writechunk=null,this.writeencoding=null}function n(e,t,r){var n=e._transformState;n.transforming=!1;var i=n.writecb;if(!i)return e.emit("error",new Error("no writecb in Transform class"));n.writechunk=null,n.writecb=null,null!==r&&void 0!==r&&e.push(r),i(t);var a=e._readableState;a.reading=!1,(a.needReadable||a.length<a.highWaterMark)&&e._read(a.highWaterMark)}function i(e){if(!(this instanceof i))return new i(e);o.call(this,e),this._transformState=new r(this);var t=this;this._readableState.needReadable=!0,this._readableState.sync=!1,e&&("function"==typeof e.transform&&(this._transform=e.transform),"function"==typeof e.flush&&(this._flush=e.flush)),this.once("prefinish",function(){"function"==typeof this._flush?this._flush(function(e){a(t,e)}):a(t)})}function a(e,t){if(t)return e.emit("error",t);var r=e._writableState,n=e._transformState;if(r.length)throw new Error("calling transform done when ws.length != 0");if(n.transforming)throw new Error("calling transform done when still transforming");return e.push(null)}t.exports=i;var o=e("./_stream_duplex"),s=e("core-util-is");s.inherits=e("inherits"),s.inherits(i,o),i.prototype.push=function(e,t){return this._transformState.needTransform=!1,o.prototype.push.call(this,e,t)},i.prototype._transform=function(){throw new Error("not implemented")},i.prototype._write=function(e,t,r){var n=this._transformState;if(n.writecb=r,n.writechunk=e,n.writeencoding=t,!n.transforming){var i=this._readableState;(n.needTransform||i.needReadable||i.length<i.highWaterMark)&&this._read(i.highWaterMark)}},i.prototype._read=function(){var e=this._transformState;null!==e.writechunk&&e.writecb&&!e.transforming?(e.transforming=!0,this._transform(e.writechunk,e.writeencoding,e.afterTransform)):e.needTransform=!0}},{"./_stream_duplex":252,"core-util-is":164,inherits:187}],256:[function(e,t){(function(r){"use strict";function n(){}function i(e,t,r){this.chunk=e,this.encoding=t,this.callback=r,this.next=null}function a(t,r){j=j||e("./_stream_duplex"),t=t||{},this.objectMode=!!t.objectMode,r instanceof j&&(this.objectMode=this.objectMode||!!t.writableObjectMode);var n=t.highWaterMark,i=this.objectMode?16:16384;this.highWaterMark=n||0===n?n:i,this.highWaterMark=~~this.highWaterMark,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1;var a=t.decodeStrings===!1;this.decodeStrings=!a,this.defaultEncoding=t.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(e){p(r,e)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.bufferedRequestCount=0,this.corkedRequestsFree=new w(this),this.corkedRequestsFree.next=new w(this)}function o(t){return j=j||e("./_stream_duplex"),this instanceof o||this instanceof j?(this._writableState=new a(t,this),this.writable=!0,t&&("function"==typeof t.write&&(this._write=t.write),"function"==typeof t.writev&&(this._writev=t.writev)),void S.call(this)):new o(t)}function s(e,t){var r=new Error("write after end");e.emit("error",r),k(t,r)}function l(e,t,r,n){var i=!0;if(!T.isBuffer(r)&&"string"!=typeof r&&null!==r&&void 0!==r&&!t.objectMode){var a=new TypeError("Invalid non-string/buffer chunk");e.emit("error",a),k(n,a),i=!1}return i}function u(e,t,r){return e.objectMode||e.decodeStrings===!1||"string"!=typeof t||(t=new T(t,r)),t}function c(e,t,r,n,a){r=u(t,r,n),T.isBuffer(r)&&(n="buffer");var o=t.objectMode?1:r.length;t.length+=o;var s=t.length<t.highWaterMark;if(s||(t.needDrain=!0),t.writing||t.corked){var l=t.lastBufferedRequest;t.lastBufferedRequest=new i(r,n,a),l?l.next=t.lastBufferedRequest:t.bufferedRequest=t.lastBufferedRequest,t.bufferedRequestCount+=1}else f(e,t,!1,o,r,n,a);return s}function f(e,t,r,n,i,a,o){t.writelen=n,t.writecb=o,t.writing=!0,t.sync=!0,r?e._writev(i,t.onwrite):e._write(i,a,t.onwrite),t.sync=!1}function h(e,t,r,n,i){--t.pendingcb,r?k(i,n):i(n),e._writableState.errorEmitted=!0,e.emit("error",n)}function d(e){e.writing=!1,e.writecb=null,e.length-=e.writelen,e.writelen=0}function p(e,t){var r=e._writableState,n=r.sync,i=r.writecb;if(d(r),t)h(e,r,n,t,i);else{var a=v(r);a||r.corked||r.bufferProcessing||!r.bufferedRequest||g(e,r),n?A(m,e,r,a,i):m(e,r,a,i)}}function m(e,t,r,n){r||_(e,t),t.pendingcb--,n(),b(e,t)}function _(e,t){0===t.length&&t.needDrain&&(t.needDrain=!1,e.emit("drain"))}function g(e,t){t.bufferProcessing=!0;var r=t.bufferedRequest;if(e._writev&&r&&r.next){var n=t.bufferedRequestCount,i=new Array(n),a=t.corkedRequestsFree;a.entry=r;for(var o=0;r;)i[o]=r,r=r.next,o+=1;f(e,t,!0,t.length,i,"",a.finish),t.pendingcb++,t.lastBufferedRequest=null,t.corkedRequestsFree=a.next,a.next=null}else{for(;r;){var s=r.chunk,l=r.encoding,u=r.callback,c=t.objectMode?1:s.length;if(f(e,t,!1,c,s,l,u),r=r.next,t.writing)break}null===r&&(t.lastBufferedRequest=null)}t.bufferedRequestCount=0,t.bufferedRequest=r,t.bufferProcessing=!1}function v(e){return e.ending&&0===e.length&&null===e.bufferedRequest&&!e.finished&&!e.writing}function y(e,t){t.prefinished||(t.prefinished=!0,e.emit("prefinish"))}function b(e,t){var r=v(t);return r&&(0===t.pendingcb?(y(e,t),t.finished=!0,e.emit("finish")):y(e,t)),r}function x(e,t,r){t.ending=!0,b(e,t),r&&(t.finished?k(r):e.once("finish",r)),t.ended=!0,e.writable=!1}function w(e){var t=this;this.next=null,this.entry=null,this.finish=function(r){var n=t.entry;for(t.entry=null;n;){var i=n.callback;e.pendingcb--,i(r),n=n.next}e.corkedRequestsFree?e.corkedRequestsFree.next=t:e.corkedRequestsFree=t}}t.exports=o;var k=e("process-nextick-args"),A=!r.browser&&["v0.10","v0.9."].indexOf(r.version.slice(0,5))>-1?setImmediate:k,T=e("buffer").Buffer;o.WritableState=a;var E=e("core-util-is");E.inherits=e("inherits");var S,R={deprecate:e("util-deprecate")};!function(){try{S=e("stream")}catch(t){}finally{S||(S=e("events").EventEmitter)}}();var T=e("buffer").Buffer;E.inherits(o,S);var j;a.prototype.getBuffer=function(){for(var e=this.bufferedRequest,t=[];e;)t.push(e),e=e.next;return t},function(){try{Object.defineProperty(a.prototype,"buffer",{get:R.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.")})}catch(e){}}();var j;o.prototype.pipe=function(){this.emit("error",new Error("Cannot pipe. Not readable."))},o.prototype.write=function(e,t,r){var i=this._writableState,a=!1;return"function"==typeof t&&(r=t,t=null),T.isBuffer(e)?t="buffer":t||(t=i.defaultEncoding),"function"!=typeof r&&(r=n),i.ended?s(this,r):l(this,i,e,r)&&(i.pendingcb++,a=c(this,i,e,t,r)),a},o.prototype.cork=function(){var e=this._writableState;e.corked++},o.prototype.uncork=function(){var e=this._writableState;e.corked&&(e.corked--,e.writing||e.corked||e.finished||e.bufferProcessing||!e.bufferedRequest||g(this,e))},o.prototype.setDefaultEncoding=function(e){if("string"==typeof e&&(e=e.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((e+"").toLowerCase())>-1))throw new TypeError("Unknown encoding: "+e);this._writableState.defaultEncoding=e},o.prototype._write=function(e,t,r){r(new Error("not implemented"))},o.prototype._writev=null,o.prototype.end=function(e,t,r){var n=this._writableState;"function"==typeof e?(r=e,e=null,t=null):"function"==typeof t&&(r=t,t=null),null!==e&&void 0!==e&&this.write(e,t),n.corked&&(n.corked=1,this.uncork()),n.ending||n.finished||x(this,n,r)}}).call(this,e("_process"))},{"./_stream_duplex":252,_process:279,buffer:41,"core-util-is":164,events:168,inherits:187,"process-nextick-args":278,"util-deprecate":286}],257:[function(e,t,r){var n=function(){try{return e("stream")}catch(t){}}();r=t.exports=e("./lib/_stream_readable.js"),r.Stream=n||r,r.Readable=r,r.Writable=e("./lib/_stream_writable.js"),r.Duplex=e("./lib/_stream_duplex.js"),r.Transform=e("./lib/_stream_transform.js"),r.PassThrough=e("./lib/_stream_passthrough.js")},{"./lib/_stream_duplex.js":252,"./lib/_stream_passthrough.js":253,"./lib/_stream_readable.js":254,"./lib/_stream_transform.js":255,"./lib/_stream_writable.js":256}],258:[function(e,t){"use strict";function r(e){return null!=e}function n(e){return"("+e+")"}function i(e){return"string"==typeof e?'"'+e+'"':e}function a(e){return"$"===e[0]?"context."+e.substring(1):"context.feature.properties."+e}function o(){return" true "}function s(e,t){return n(i(t)+" === "+a(e))}function l(e,t){return n(t.map(function(t){return s(e,t)}).join(" || "))}function u(e,t){return n(e.filter(r).map(function(e){return n(e.join(" && "))}).join(" "+t+" "))}function c(e,t,r){return t&&t.length>0?u(t.map(function(e){return _(e,r)}),"||"):"true"}function f(e,t,r){return t&&t.length>0?u(t.map(function(e){return _(e,r)}),"&&"):"true"}function h(e,t,r){return"!"+n(_(t,r).join(" && "))}function d(e,t,r){return"!"+n(c(null,t,r))}function p(e,t){return n(a(e)+(t?" != ":" == ")+"null")}function m(e,t,r){var i=[],o=r&&"function"==typeof r.rangeTransform&&r.rangeTransform;if(t.max){var s=o?o(t.max):t.max;i.push(""+a(e)+" < "+s)}if(t.min){var l=o?l=o(t.min):t.min;i.push(""+a(e)+" >= "+l)}return n(i.join(" && "))}function _(e,t){var r=[];if("function"==typeof e)return[n(e.toString()+"(context)")];if(Array.isArray(e))return[c(null,e,t)];if(null==e)return["true"];for(var i=Object.keys(e),a=0;a<i.length;a++){var u=i[a],_=e[u],g=typeof _;if("string"===g||"number"===g)r.push(s(u,_));else if("boolean"===g)r.push(p(u,_));else if("not"===u)r.push(h(u,_,t));else if("any"===u)r.push(c(u,_,t));else if("all"===u)r.push(f(u,_,t));else if("none"===u)r.push(d(u,_,t));else if(Array.isArray(_))r.push(l(u,_));else if("object"===g&&null!=_)(_.max||_.min)&&r.push(m(u,_,t));else{if(null!=_)throw new Error("Unknown Query sytnax: "+_);r.push(o(u,_))}}return 0===i.length?["true"]:r}function g(e){return n(e.join(" && "))}function v(e,t){return null==e?function(){return!0}:new Function("context","return "+g(_(e,t))+";")}t.exports={match:v,filterToString:g,parseFilter:_}},{}],259:[function(e,t){"use strict";var r=e("./lib/utils/common").assign,n=e("./lib/deflate"),i=e("./lib/inflate"),a=e("./lib/zlib/constants"),o={};r(o,n,i,a),t.exports=o},{"./lib/deflate":260,"./lib/inflate":261,"./lib/utils/common":262,"./lib/zlib/constants":265}],260:[function(e,t,r){"use strict";function n(e){if(!(this instanceof n))return new n(e);this.options=l.assign({level:v,method:b,chunkSize:16384,windowBits:15,memLevel:8,strategy:y,to:""},e||{});var t=this.options;t.raw&&t.windowBits>0?t.windowBits=-t.windowBits:t.gzip&&t.windowBits>0&&t.windowBits<16&&(t.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new f,this.strm.avail_out=0;var r=s.deflateInit2(this.strm,t.level,t.method,t.windowBits,t.memLevel,t.strategy);if(r!==m)throw new Error(c[r]);if(t.header&&s.deflateSetHeader(this.strm,t.header),t.dictionary){var i;if(i="string"==typeof t.dictionary?u.string2buf(t.dictionary):"[object ArrayBuffer]"===h.call(t.dictionary)?new Uint8Array(t.dictionary):t.dictionary,r=s.deflateSetDictionary(this.strm,i),r!==m)throw new Error(c[r]);this._dict_set=!0}}function i(e,t){var r=new n(t);if(r.push(e,!0),r.err)throw r.msg;return r.result}function a(e,t){return t=t||{},t.raw=!0,i(e,t)}function o(e,t){return t=t||{},t.gzip=!0,i(e,t)}var s=e("./zlib/deflate"),l=e("./utils/common"),u=e("./utils/strings"),c=e("./zlib/messages"),f=e("./zlib/zstream"),h=Object.prototype.toString,d=0,p=4,m=0,_=1,g=2,v=-1,y=0,b=8;n.prototype.push=function(e,t){var r,n,i=this.strm,a=this.options.chunkSize;if(this.ended)return!1;n=t===~~t?t:t===!0?p:d,i.input="string"==typeof e?u.string2buf(e):"[object ArrayBuffer]"===h.call(e)?new Uint8Array(e):e,i.next_in=0,i.avail_in=i.input.length;do{if(0===i.avail_out&&(i.output=new l.Buf8(a),i.next_out=0,i.avail_out=a),r=s.deflate(i,n),r!==_&&r!==m)return this.onEnd(r),this.ended=!0,!1;(0===i.avail_out||0===i.avail_in&&(n===p||n===g))&&this.onData("string"===this.options.to?u.buf2binstring(l.shrinkBuf(i.output,i.next_out)):l.shrinkBuf(i.output,i.next_out))}while((i.avail_in>0||0===i.avail_out)&&r!==_);return n===p?(r=s.deflateEnd(this.strm),this.onEnd(r),this.ended=!0,r===m):n===g?(this.onEnd(m),i.avail_out=0,!0):!0},n.prototype.onData=function(e){this.chunks.push(e)},n.prototype.onEnd=function(e){e===m&&(this.result="string"===this.options.to?this.chunks.join(""):l.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg},r.Deflate=n,r.deflate=i,r.deflateRaw=a,r.gzip=o},{"./utils/common":262,"./utils/strings":263,"./zlib/deflate":267,"./zlib/messages":272,"./zlib/zstream":274}],261:[function(e,t,r){"use strict";function n(e){if(!(this instanceof n))return new n(e);this.options=s.assign({chunkSize:16384,windowBits:0,to:""},e||{});var t=this.options;t.raw&&t.windowBits>=0&&t.windowBits<16&&(t.windowBits=-t.windowBits,0===t.windowBits&&(t.windowBits=-15)),!(t.windowBits>=0&&t.windowBits<16)||e&&e.windowBits||(t.windowBits+=32),t.windowBits>15&&t.windowBits<48&&0===(15&t.windowBits)&&(t.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new f,this.strm.avail_out=0;var r=o.inflateInit2(this.strm,t.windowBits);if(r!==u.Z_OK)throw new Error(c[r]);this.header=new h,o.inflateGetHeader(this.strm,this.header)}function i(e,t){var r=new n(t);if(r.push(e,!0),r.err)throw r.msg;return r.result}function a(e,t){return t=t||{},t.raw=!0,i(e,t)}var o=e("./zlib/inflate"),s=e("./utils/common"),l=e("./utils/strings"),u=e("./zlib/constants"),c=e("./zlib/messages"),f=e("./zlib/zstream"),h=e("./zlib/gzheader"),d=Object.prototype.toString;n.prototype.push=function(e,t){var r,n,i,a,c,f,h=this.strm,p=this.options.chunkSize,m=this.options.dictionary,_=!1;if(this.ended)return!1;n=t===~~t?t:t===!0?u.Z_FINISH:u.Z_NO_FLUSH,h.input="string"==typeof e?l.binstring2buf(e):"[object ArrayBuffer]"===d.call(e)?new Uint8Array(e):e,h.next_in=0,h.avail_in=h.input.length;do{if(0===h.avail_out&&(h.output=new s.Buf8(p),h.next_out=0,h.avail_out=p),r=o.inflate(h,u.Z_NO_FLUSH),r===u.Z_NEED_DICT&&m&&(f="string"==typeof m?l.string2buf(m):"[object ArrayBuffer]"===d.call(m)?new Uint8Array(m):m,r=o.inflateSetDictionary(this.strm,f)),r===u.Z_BUF_ERROR&&_===!0&&(r=u.Z_OK,_=!1),r!==u.Z_STREAM_END&&r!==u.Z_OK)return this.onEnd(r),this.ended=!0,!1;h.next_out&&(0===h.avail_out||r===u.Z_STREAM_END||0===h.avail_in&&(n===u.Z_FINISH||n===u.Z_SYNC_FLUSH))&&("string"===this.options.to?(i=l.utf8border(h.output,h.next_out),a=h.next_out-i,c=l.buf2string(h.output,i),h.next_out=a,h.avail_out=p-a,a&&s.arraySet(h.output,h.output,i,a,0),this.onData(c)):this.onData(s.shrinkBuf(h.output,h.next_out))),0===h.avail_in&&0===h.avail_out&&(_=!0)}while((h.avail_in>0||0===h.avail_out)&&r!==u.Z_STREAM_END);return r===u.Z_STREAM_END&&(n=u.Z_FINISH),n===u.Z_FINISH?(r=o.inflateEnd(this.strm),this.onEnd(r),this.ended=!0,r===u.Z_OK):n===u.Z_SYNC_FLUSH?(this.onEnd(u.Z_OK),h.avail_out=0,!0):!0},n.prototype.onData=function(e){this.chunks.push(e)},n.prototype.onEnd=function(e){e===u.Z_OK&&(this.result="string"===this.options.to?this.chunks.join(""):s.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg},r.Inflate=n,r.inflate=i,r.inflateRaw=a,r.ungzip=i},{"./utils/common":262,"./utils/strings":263,"./zlib/constants":265,"./zlib/gzheader":268,"./zlib/inflate":270,"./zlib/messages":272,"./zlib/zstream":274}],262:[function(e,t,r){"use strict";var n="undefined"!=typeof Uint8Array&&"undefined"!=typeof Uint16Array&&"undefined"!=typeof Int32Array;r.assign=function(e){for(var t=Array.prototype.slice.call(arguments,1);t.length;){var r=t.shift();if(r){if("object"!=typeof r)throw new TypeError(r+"must be non-object");for(var n in r)r.hasOwnProperty(n)&&(e[n]=r[n])}}return e},r.shrinkBuf=function(e,t){return e.length===t?e:e.subarray?e.subarray(0,t):(e.length=t,e)};var i={arraySet:function(e,t,r,n,i){if(t.subarray&&e.subarray)return void e.set(t.subarray(r,r+n),i);for(var a=0;n>a;a++)e[i+a]=t[r+a]},flattenChunks:function(e){var t,r,n,i,a,o;for(n=0,t=0,r=e.length;r>t;t++)n+=e[t].length;for(o=new Uint8Array(n),i=0,t=0,r=e.length;r>t;t++)a=e[t],o.set(a,i),i+=a.length;return o}},a={arraySet:function(e,t,r,n,i){for(var a=0;n>a;a++)e[i+a]=t[r+a]},flattenChunks:function(e){return[].concat.apply([],e)}};r.setTyped=function(e){e?(r.Buf8=Uint8Array,r.Buf16=Uint16Array,r.Buf32=Int32Array,r.assign(r,i)):(r.Buf8=Array,r.Buf16=Array,r.Buf32=Array,r.assign(r,a))},r.setTyped(n)},{}],263:[function(e,t,r){"use strict";function n(e,t){if(65537>t&&(e.subarray&&o||!e.subarray&&a))return String.fromCharCode.apply(null,i.shrinkBuf(e,t));for(var r="",n=0;t>n;n++)r+=String.fromCharCode(e[n]);return r}var i=e("./common"),a=!0,o=!0;try{String.fromCharCode.apply(null,[0])}catch(s){a=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(s){o=!1}for(var l=new i.Buf8(256),u=0;256>u;u++)l[u]=u>=252?6:u>=248?5:u>=240?4:u>=224?3:u>=192?2:1;l[254]=l[254]=1,r.string2buf=function(e){var t,r,n,a,o,s=e.length,l=0;for(a=0;s>a;a++)r=e.charCodeAt(a),55296===(64512&r)&&s>a+1&&(n=e.charCodeAt(a+1),56320===(64512&n)&&(r=65536+(r-55296<<10)+(n-56320),a++)),l+=128>r?1:2048>r?2:65536>r?3:4;for(t=new i.Buf8(l),o=0,a=0;l>o;a++)r=e.charCodeAt(a),55296===(64512&r)&&s>a+1&&(n=e.charCodeAt(a+1),56320===(64512&n)&&(r=65536+(r-55296<<10)+(n-56320),a++)),128>r?t[o++]=r:2048>r?(t[o++]=192|r>>>6,t[o++]=128|63&r):65536>r?(t[o++]=224|r>>>12,t[o++]=128|r>>>6&63,t[o++]=128|63&r):(t[o++]=240|r>>>18,t[o++]=128|r>>>12&63,t[o++]=128|r>>>6&63,t[o++]=128|63&r);return t},r.buf2binstring=function(e){return n(e,e.length)},r.binstring2buf=function(e){for(var t=new i.Buf8(e.length),r=0,n=t.length;n>r;r++)t[r]=e.charCodeAt(r);return t},r.buf2string=function(e,t){var r,i,a,o,s=t||e.length,u=new Array(2*s);for(i=0,r=0;s>r;)if(a=e[r++],128>a)u[i++]=a;else if(o=l[a],o>4)u[i++]=65533,r+=o-1;else{for(a&=2===o?31:3===o?15:7;o>1&&s>r;)a=a<<6|63&e[r++],o--;o>1?u[i++]=65533:65536>a?u[i++]=a:(a-=65536,u[i++]=55296|a>>10&1023,u[i++]=56320|1023&a)}return n(u,i)},r.utf8border=function(e,t){var r;for(t=t||e.length,t>e.length&&(t=e.length),r=t-1;r>=0&&128===(192&e[r]);)r--;return 0>r?t:0===r?t:r+l[e[r]]>t?r:t}},{"./common":262}],264:[function(e,t){"use strict";function r(e,t,r,n){for(var i=65535&e|0,a=e>>>16&65535|0,o=0;0!==r;){o=r>2e3?2e3:r,r-=o;do i=i+t[n++]|0,a=a+i|0;while(--o);i%=65521,a%=65521}return i|a<<16|0}t.exports=r},{}],265:[function(e,t){"use strict";t.exports={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8}},{}],266:[function(e,t){"use strict";function r(){for(var e,t=[],r=0;256>r;r++){e=r;for(var n=0;8>n;n++)e=1&e?3988292384^e>>>1:e>>>1;t[r]=e}return t}function n(e,t,r,n){var a=i,o=n+r;e^=-1;for(var s=n;o>s;s++)e=e>>>8^a[255&(e^t[s])];return-1^e}var i=r();t.exports=n},{}],267:[function(e,t,r){"use strict";function n(e,t){return e.msg=N[t],t}function i(e){return(e<<1)-(e>4?9:0)}function a(e){for(var t=e.length;--t>=0;)e[t]=0}function o(e){var t=e.state,r=t.pending;r>e.avail_out&&(r=e.avail_out),0!==r&&(M.arraySet(e.output,t.pending_buf,t.pending_out,r,e.next_out),e.next_out+=r,t.pending_out+=r,e.total_out+=r,e.avail_out-=r,t.pending-=r,0===t.pending&&(t.pending_out=0))}function s(e,t){z._tr_flush_block(e,e.block_start>=0?e.block_start:-1,e.strstart-e.block_start,t),e.block_start=e.strstart,o(e.strm)}function l(e,t){e.pending_buf[e.pending++]=t}function u(e,t){e.pending_buf[e.pending++]=t>>>8&255,e.pending_buf[e.pending++]=255&t}function c(e,t,r,n){var i=e.avail_in;return i>n&&(i=n),0===i?0:(e.avail_in-=i,M.arraySet(t,e.input,e.next_in,i,r),1===e.state.wrap?e.adler=C(e.adler,t,i,r):2===e.state.wrap&&(e.adler=P(e.adler,t,i,r)),e.next_in+=i,e.total_in+=i,i)}function f(e,t){var r,n,i=e.max_chain_length,a=e.strstart,o=e.prev_length,s=e.nice_match,l=e.strstart>e.w_size-ft?e.strstart-(e.w_size-ft):0,u=e.window,c=e.w_mask,f=e.prev,h=e.strstart+ct,d=u[a+o-1],p=u[a+o];e.prev_length>=e.good_match&&(i>>=2),s>e.lookahead&&(s=e.lookahead);do if(r=t,u[r+o]===p&&u[r+o-1]===d&&u[r]===u[a]&&u[++r]===u[a+1]){a+=2,r++;do;while(u[++a]===u[++r]&&u[++a]===u[++r]&&u[++a]===u[++r]&&u[++a]===u[++r]&&u[++a]===u[++r]&&u[++a]===u[++r]&&u[++a]===u[++r]&&u[++a]===u[++r]&&h>a);if(n=ct-(h-a),a=h-ct,n>o){if(e.match_start=t,o=n,n>=s)break;d=u[a+o-1],p=u[a+o]}}while((t=f[t&c])>l&&0!==--i);return o<=e.lookahead?o:e.lookahead}function h(e){var t,r,n,i,a,o=e.w_size;do{if(i=e.window_size-e.lookahead-e.strstart,e.strstart>=o+(o-ft)){M.arraySet(e.window,e.window,o,o,0),e.match_start-=o,e.strstart-=o,e.block_start-=o,r=e.hash_size,t=r;do n=e.head[--t],e.head[t]=n>=o?n-o:0;while(--r);r=o,t=r;do n=e.prev[--t],e.prev[t]=n>=o?n-o:0;while(--r);i+=o}if(0===e.strm.avail_in)break;if(r=c(e.strm,e.window,e.strstart+e.lookahead,i),e.lookahead+=r,e.lookahead+e.insert>=ut)for(a=e.strstart-e.insert,e.ins_h=e.window[a],e.ins_h=(e.ins_h<<e.hash_shift^e.window[a+1])&e.hash_mask;e.insert&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[a+ut-1])&e.hash_mask,e.prev[a&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=a,a++,e.insert--,!(e.lookahead+e.insert<ut)););}while(e.lookahead<ft&&0!==e.strm.avail_in)}function d(e,t){var r=65535;for(r>e.pending_buf_size-5&&(r=e.pending_buf_size-5);;){if(e.lookahead<=1){if(h(e),0===e.lookahead&&t===L)return bt;if(0===e.lookahead)break}e.strstart+=e.lookahead,e.lookahead=0;var n=e.block_start+r;if((0===e.strstart||e.strstart>=n)&&(e.lookahead=e.strstart-n,e.strstart=n,s(e,!1),0===e.strm.avail_out))return bt;if(e.strstart-e.block_start>=e.w_size-ft&&(s(e,!1),0===e.strm.avail_out))return bt}return e.insert=0,t===F?(s(e,!0),0===e.strm.avail_out?wt:kt):e.strstart>e.block_start&&(s(e,!1),0===e.strm.avail_out)?bt:bt}function p(e,t){for(var r,n;;){if(e.lookahead<ft){if(h(e),e.lookahead<ft&&t===L)return bt;if(0===e.lookahead)break}if(r=0,e.lookahead>=ut&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+ut-1])&e.hash_mask,r=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),0!==r&&e.strstart-r<=e.w_size-ft&&(e.match_length=f(e,r)),e.match_length>=ut)if(n=z._tr_tally(e,e.strstart-e.match_start,e.match_length-ut),e.lookahead-=e.match_length,e.match_length<=e.max_lazy_match&&e.lookahead>=ut){e.match_length--;do e.strstart++,e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+ut-1])&e.hash_mask,r=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart;while(0!==--e.match_length);e.strstart++}else e.strstart+=e.match_length,e.match_length=0,e.ins_h=e.window[e.strstart],e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+1])&e.hash_mask;else n=z._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++;if(n&&(s(e,!1),0===e.strm.avail_out))return bt}return e.insert=e.strstart<ut-1?e.strstart:ut-1,t===F?(s(e,!0),0===e.strm.avail_out?wt:kt):e.last_lit&&(s(e,!1),0===e.strm.avail_out)?bt:xt}function m(e,t){for(var r,n,i;;){if(e.lookahead<ft){if(h(e),e.lookahead<ft&&t===L)return bt;if(0===e.lookahead)break 8 }if(r=0,e.lookahead>=ut&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+ut-1])&e.hash_mask,r=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),e.prev_length=e.match_length,e.prev_match=e.match_start,e.match_length=ut-1,0!==r&&e.prev_length<e.max_lazy_match&&e.strstart-r<=e.w_size-ft&&(e.match_length=f(e,r),e.match_length<=5&&(e.strategy===Z||e.match_length===ut&&e.strstart-e.match_start>4096)&&(e.match_length=ut-1)),e.prev_length>=ut&&e.match_length<=e.prev_length){i=e.strstart+e.lookahead-ut,n=z._tr_tally(e,e.strstart-1-e.prev_match,e.prev_length-ut),e.lookahead-=e.prev_length-1,e.prev_length-=2;do++e.strstart<=i&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+ut-1])&e.hash_mask,r=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart);while(0!==--e.prev_length);if(e.match_available=0,e.match_length=ut-1,e.strstart++,n&&(s(e,!1),0===e.strm.avail_out))return bt}else if(e.match_available){if(n=z._tr_tally(e,0,e.window[e.strstart-1]),n&&s(e,!1),e.strstart++,e.lookahead--,0===e.strm.avail_out)return bt}else e.match_available=1,e.strstart++,e.lookahead--}return e.match_available&&(n=z._tr_tally(e,0,e.window[e.strstart-1]),e.match_available=0),e.insert=e.strstart<ut-1?e.strstart:ut-1,t===F?(s(e,!0),0===e.strm.avail_out?wt:kt):e.last_lit&&(s(e,!1),0===e.strm.avail_out)?bt:xt}function _(e,t){for(var r,n,i,a,o=e.window;;){if(e.lookahead<=ct){if(h(e),e.lookahead<=ct&&t===L)return bt;if(0===e.lookahead)break}if(e.match_length=0,e.lookahead>=ut&&e.strstart>0&&(i=e.strstart-1,n=o[i],n===o[++i]&&n===o[++i]&&n===o[++i])){a=e.strstart+ct;do;while(n===o[++i]&&n===o[++i]&&n===o[++i]&&n===o[++i]&&n===o[++i]&&n===o[++i]&&n===o[++i]&&n===o[++i]&&a>i);e.match_length=ct-(a-i),e.match_length>e.lookahead&&(e.match_length=e.lookahead)}if(e.match_length>=ut?(r=z._tr_tally(e,1,e.match_length-ut),e.lookahead-=e.match_length,e.strstart+=e.match_length,e.match_length=0):(r=z._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++),r&&(s(e,!1),0===e.strm.avail_out))return bt}return e.insert=0,t===F?(s(e,!0),0===e.strm.avail_out?wt:kt):e.last_lit&&(s(e,!1),0===e.strm.avail_out)?bt:xt}function g(e,t){for(var r;;){if(0===e.lookahead&&(h(e),0===e.lookahead)){if(t===L)return bt;break}if(e.match_length=0,r=z._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++,r&&(s(e,!1),0===e.strm.avail_out))return bt}return e.insert=0,t===F?(s(e,!0),0===e.strm.avail_out?wt:kt):e.last_lit&&(s(e,!1),0===e.strm.avail_out)?bt:xt}function v(e,t,r,n,i){this.good_length=e,this.max_lazy=t,this.nice_length=r,this.max_chain=n,this.func=i}function y(e){e.window_size=2*e.w_size,a(e.head),e.max_lazy_match=j[e.level].max_lazy,e.good_match=j[e.level].good_length,e.nice_match=j[e.level].nice_length,e.max_chain_length=j[e.level].max_chain,e.strstart=0,e.block_start=0,e.lookahead=0,e.insert=0,e.match_length=e.prev_length=ut-1,e.match_available=0,e.ins_h=0}function b(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=$,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new M.Buf16(2*st),this.dyn_dtree=new M.Buf16(2*(2*at+1)),this.bl_tree=new M.Buf16(2*(2*ot+1)),a(this.dyn_ltree),a(this.dyn_dtree),a(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new M.Buf16(lt+1),this.heap=new M.Buf16(2*it+1),a(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new M.Buf16(2*it+1),a(this.depth),this.l_buf=0,this.lit_bufsize=0,this.last_lit=0,this.d_buf=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}function x(e){var t;return e&&e.state?(e.total_in=e.total_out=0,e.data_type=K,t=e.state,t.pending=0,t.pending_out=0,t.wrap<0&&(t.wrap=-t.wrap),t.status=t.wrap?dt:vt,e.adler=2===t.wrap?0:1,t.last_flush=L,z._tr_init(t),D):n(e,G)}function w(e){var t=x(e);return t===D&&y(e.state),t}function k(e,t){return e&&e.state?2!==e.state.wrap?G:(e.state.gzhead=t,D):G}function A(e,t,r,i,a,o){if(!e)return G;var s=1;if(t===q&&(t=6),0>i?(s=0,i=-i):i>15&&(s=2,i-=16),1>a||a>Q||r!==$||8>i||i>15||0>t||t>9||0>o||o>Y)return n(e,G);8===i&&(i=9);var l=new b;return e.state=l,l.strm=e,l.wrap=s,l.gzhead=null,l.w_bits=i,l.w_size=1<<l.w_bits,l.w_mask=l.w_size-1,l.hash_bits=a+7,l.hash_size=1<<l.hash_bits,l.hash_mask=l.hash_size-1,l.hash_shift=~~((l.hash_bits+ut-1)/ut),l.window=new M.Buf8(2*l.w_size),l.head=new M.Buf16(l.hash_size),l.prev=new M.Buf16(l.w_size),l.lit_bufsize=1<<a+6,l.pending_buf_size=4*l.lit_bufsize,l.pending_buf=new M.Buf8(l.pending_buf_size),l.d_buf=1*l.lit_bufsize,l.l_buf=3*l.lit_bufsize,l.level=t,l.strategy=o,l.method=r,w(e)}function T(e,t){return A(e,t,$,et,tt,J)}function E(e,t){var r,s,c,f;if(!e||!e.state||t>U||0>t)return e?n(e,G):G;if(s=e.state,!e.output||!e.input&&0!==e.avail_in||s.status===yt&&t!==F)return n(e,0===e.avail_out?W:G);if(s.strm=e,r=s.last_flush,s.last_flush=t,s.status===dt)if(2===s.wrap)e.adler=0,l(s,31),l(s,139),l(s,8),s.gzhead?(l(s,(s.gzhead.text?1:0)+(s.gzhead.hcrc?2:0)+(s.gzhead.extra?4:0)+(s.gzhead.name?8:0)+(s.gzhead.comment?16:0)),l(s,255&s.gzhead.time),l(s,s.gzhead.time>>8&255),l(s,s.gzhead.time>>16&255),l(s,s.gzhead.time>>24&255),l(s,9===s.level?2:s.strategy>=H||s.level<2?4:0),l(s,255&s.gzhead.os),s.gzhead.extra&&s.gzhead.extra.length&&(l(s,255&s.gzhead.extra.length),l(s,s.gzhead.extra.length>>8&255)),s.gzhead.hcrc&&(e.adler=P(e.adler,s.pending_buf,s.pending,0)),s.gzindex=0,s.status=pt):(l(s,0),l(s,0),l(s,0),l(s,0),l(s,0),l(s,9===s.level?2:s.strategy>=H||s.level<2?4:0),l(s,At),s.status=vt);else{var h=$+(s.w_bits-8<<4)<<8,d=-1;d=s.strategy>=H||s.level<2?0:s.level<6?1:6===s.level?2:3,h|=d<<6,0!==s.strstart&&(h|=ht),h+=31-h%31,s.status=vt,u(s,h),0!==s.strstart&&(u(s,e.adler>>>16),u(s,65535&e.adler)),e.adler=1}if(s.status===pt)if(s.gzhead.extra){for(c=s.pending;s.gzindex<(65535&s.gzhead.extra.length)&&(s.pending!==s.pending_buf_size||(s.gzhead.hcrc&&s.pending>c&&(e.adler=P(e.adler,s.pending_buf,s.pending-c,c)),o(e),c=s.pending,s.pending!==s.pending_buf_size));)l(s,255&s.gzhead.extra[s.gzindex]),s.gzindex++;s.gzhead.hcrc&&s.pending>c&&(e.adler=P(e.adler,s.pending_buf,s.pending-c,c)),s.gzindex===s.gzhead.extra.length&&(s.gzindex=0,s.status=mt)}else s.status=mt;if(s.status===mt)if(s.gzhead.name){c=s.pending;do{if(s.pending===s.pending_buf_size&&(s.gzhead.hcrc&&s.pending>c&&(e.adler=P(e.adler,s.pending_buf,s.pending-c,c)),o(e),c=s.pending,s.pending===s.pending_buf_size)){f=1;break}f=s.gzindex<s.gzhead.name.length?255&s.gzhead.name.charCodeAt(s.gzindex++):0,l(s,f)}while(0!==f);s.gzhead.hcrc&&s.pending>c&&(e.adler=P(e.adler,s.pending_buf,s.pending-c,c)),0===f&&(s.gzindex=0,s.status=_t)}else s.status=_t;if(s.status===_t)if(s.gzhead.comment){c=s.pending;do{if(s.pending===s.pending_buf_size&&(s.gzhead.hcrc&&s.pending>c&&(e.adler=P(e.adler,s.pending_buf,s.pending-c,c)),o(e),c=s.pending,s.pending===s.pending_buf_size)){f=1;break}f=s.gzindex<s.gzhead.comment.length?255&s.gzhead.comment.charCodeAt(s.gzindex++):0,l(s,f)}while(0!==f);s.gzhead.hcrc&&s.pending>c&&(e.adler=P(e.adler,s.pending_buf,s.pending-c,c)),0===f&&(s.status=gt)}else s.status=gt;if(s.status===gt&&(s.gzhead.hcrc?(s.pending+2>s.pending_buf_size&&o(e),s.pending+2<=s.pending_buf_size&&(l(s,255&e.adler),l(s,e.adler>>8&255),e.adler=0,s.status=vt)):s.status=vt),0!==s.pending){if(o(e),0===e.avail_out)return s.last_flush=-1,D}else if(0===e.avail_in&&i(t)<=i(r)&&t!==F)return n(e,W);if(s.status===yt&&0!==e.avail_in)return n(e,W);if(0!==e.avail_in||0!==s.lookahead||t!==L&&s.status!==yt){var p=s.strategy===H?g(s,t):s.strategy===X?_(s,t):j[s.level].func(s,t);if((p===wt||p===kt)&&(s.status=yt),p===bt||p===wt)return 0===e.avail_out&&(s.last_flush=-1),D;if(p===xt&&(t===O?z._tr_align(s):t!==U&&(z._tr_stored_block(s,0,0,!1),t===I&&(a(s.head),0===s.lookahead&&(s.strstart=0,s.block_start=0,s.insert=0))),o(e),0===e.avail_out))return s.last_flush=-1,D}return t!==F?D:s.wrap<=0?B:(2===s.wrap?(l(s,255&e.adler),l(s,e.adler>>8&255),l(s,e.adler>>16&255),l(s,e.adler>>24&255),l(s,255&e.total_in),l(s,e.total_in>>8&255),l(s,e.total_in>>16&255),l(s,e.total_in>>24&255)):(u(s,e.adler>>>16),u(s,65535&e.adler)),o(e),s.wrap>0&&(s.wrap=-s.wrap),0!==s.pending?D:B)}function S(e){var t;return e&&e.state?(t=e.state.status,t!==dt&&t!==pt&&t!==mt&&t!==_t&&t!==gt&&t!==vt&&t!==yt?n(e,G):(e.state=null,t===vt?n(e,V):D)):G}function R(e,t){var r,n,i,o,s,l,u,c,f=t.length;if(!e||!e.state)return G;if(r=e.state,o=r.wrap,2===o||1===o&&r.status!==dt||r.lookahead)return G;for(1===o&&(e.adler=C(e.adler,t,f,0)),r.wrap=0,f>=r.w_size&&(0===o&&(a(r.head),r.strstart=0,r.block_start=0,r.insert=0),c=new M.Buf8(r.w_size),M.arraySet(c,t,f-r.w_size,r.w_size,0),t=c,f=r.w_size),s=e.avail_in,l=e.next_in,u=e.input,e.avail_in=f,e.next_in=0,e.input=t,h(r);r.lookahead>=ut;){n=r.strstart,i=r.lookahead-(ut-1);do r.ins_h=(r.ins_h<<r.hash_shift^r.window[n+ut-1])&r.hash_mask,r.prev[n&r.w_mask]=r.head[r.ins_h],r.head[r.ins_h]=n,n++;while(--i);r.strstart=n,r.lookahead=ut-1,h(r)}return r.strstart+=r.lookahead,r.block_start=r.strstart,r.insert=r.lookahead,r.lookahead=0,r.match_length=r.prev_length=ut-1,r.match_available=0,e.next_in=l,e.input=u,e.avail_in=s,r.wrap=o,D}var j,M=e("../utils/common"),z=e("./trees"),C=e("./adler32"),P=e("./crc32"),N=e("./messages"),L=0,O=1,I=3,F=4,U=5,D=0,B=1,G=-2,V=-3,W=-5,q=-1,Z=1,H=2,X=3,Y=4,J=0,K=2,$=8,Q=9,et=15,tt=8,rt=29,nt=256,it=nt+1+rt,at=30,ot=19,st=2*it+1,lt=15,ut=3,ct=258,ft=ct+ut+1,ht=32,dt=42,pt=69,mt=73,_t=91,gt=103,vt=113,yt=666,bt=1,xt=2,wt=3,kt=4,At=3;j=[new v(0,0,0,0,d),new v(4,4,8,4,p),new v(4,5,16,8,p),new v(4,6,32,32,p),new v(4,4,16,16,m),new v(8,16,32,32,m),new v(8,16,128,128,m),new v(8,32,128,256,m),new v(32,128,258,1024,m),new v(32,258,258,4096,m)],r.deflateInit=T,r.deflateInit2=A,r.deflateReset=w,r.deflateResetKeep=x,r.deflateSetHeader=k,r.deflate=E,r.deflateEnd=S,r.deflateSetDictionary=R,r.deflateInfo="pako deflate (from Nodeca project)"},{"../utils/common":262,"./adler32":264,"./crc32":266,"./messages":272,"./trees":273}],268:[function(e,t){"use strict";function r(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1}t.exports=r},{}],269:[function(e,t){"use strict";var r=30,n=12;t.exports=function(e,t){var i,a,o,s,l,u,c,f,h,d,p,m,_,g,v,y,b,x,w,k,A,T,E,S,R;i=e.state,a=e.next_in,S=e.input,o=a+(e.avail_in-5),s=e.next_out,R=e.output,l=s-(t-e.avail_out),u=s+(e.avail_out-257),c=i.dmax,f=i.wsize,h=i.whave,d=i.wnext,p=i.window,m=i.hold,_=i.bits,g=i.lencode,v=i.distcode,y=(1<<i.lenbits)-1,b=(1<<i.distbits)-1;e:do{15>_&&(m+=S[a++]<<_,_+=8,m+=S[a++]<<_,_+=8),x=g[m&y];t:for(;;){if(w=x>>>24,m>>>=w,_-=w,w=x>>>16&255,0===w)R[s++]=65535&x;else{if(!(16&w)){if(0===(64&w)){x=g[(65535&x)+(m&(1<<w)-1)];continue t}if(32&w){i.mode=n;break e}e.msg="invalid literal/length code",i.mode=r;break e}k=65535&x,w&=15,w&&(w>_&&(m+=S[a++]<<_,_+=8),k+=m&(1<<w)-1,m>>>=w,_-=w),15>_&&(m+=S[a++]<<_,_+=8,m+=S[a++]<<_,_+=8),x=v[m&b];r:for(;;){if(w=x>>>24,m>>>=w,_-=w,w=x>>>16&255,!(16&w)){if(0===(64&w)){x=v[(65535&x)+(m&(1<<w)-1)];continue r}e.msg="invalid distance code",i.mode=r;break e}if(A=65535&x,w&=15,w>_&&(m+=S[a++]<<_,_+=8,w>_&&(m+=S[a++]<<_,_+=8)),A+=m&(1<<w)-1,A>c){e.msg="invalid distance too far back",i.mode=r;break e}if(m>>>=w,_-=w,w=s-l,A>w){if(w=A-w,w>h&&i.sane){e.msg="invalid distance too far back",i.mode=r;break e}if(T=0,E=p,0===d){if(T+=f-w,k>w){k-=w;do R[s++]=p[T++];while(--w);T=s-A,E=R}}else if(w>d){if(T+=f+d-w,w-=d,k>w){k-=w;do R[s++]=p[T++];while(--w);if(T=0,k>d){w=d,k-=w;do R[s++]=p[T++];while(--w);T=s-A,E=R}}}else if(T+=d-w,k>w){k-=w;do R[s++]=p[T++];while(--w);T=s-A,E=R}for(;k>2;)R[s++]=E[T++],R[s++]=E[T++],R[s++]=E[T++],k-=3;k&&(R[s++]=E[T++],k>1&&(R[s++]=E[T++]))}else{T=s-A;do R[s++]=R[T++],R[s++]=R[T++],R[s++]=R[T++],k-=3;while(k>2);k&&(R[s++]=R[T++],k>1&&(R[s++]=R[T++]))}break}}break}}while(o>a&&u>s);k=_>>3,a-=k,_-=k<<3,m&=(1<<_)-1,e.next_in=a,e.next_out=s,e.avail_in=o>a?5+(o-a):5-(a-o),e.avail_out=u>s?257+(u-s):257-(s-u),i.hold=m,i.bits=_}},{}],270:[function(e,t,r){"use strict";function n(e){return(e>>>24&255)+(e>>>8&65280)+((65280&e)<<8)+((255&e)<<24)}function i(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new v.Buf16(320),this.work=new v.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function a(e){var t;return e&&e.state?(t=e.state,e.total_in=e.total_out=t.total=0,e.msg="",t.wrap&&(e.adler=1&t.wrap),t.mode=I,t.last=0,t.havedict=0,t.dmax=32768,t.head=null,t.hold=0,t.bits=0,t.lencode=t.lendyn=new v.Buf32(mt),t.distcode=t.distdyn=new v.Buf32(_t),t.sane=1,t.back=-1,j):C}function o(e){var t;return e&&e.state?(t=e.state,t.wsize=0,t.whave=0,t.wnext=0,a(e)):C}function s(e,t){var r,n;return e&&e.state?(n=e.state,0>t?(r=0,t=-t):(r=(t>>4)+1,48>t&&(t&=15)),t&&(8>t||t>15)?C:(null!==n.window&&n.wbits!==t&&(n.window=null),n.wrap=r,n.wbits=t,o(e))):C}function l(e,t){var r,n;return e?(n=new i,e.state=n,n.window=null,r=s(e,t),r!==j&&(e.state=null),r):C}function u(e){return l(e,vt)}function c(e){if(yt){var t;for(_=new v.Buf32(512),g=new v.Buf32(32),t=0;144>t;)e.lens[t++]=8;for(;256>t;)e.lens[t++]=9;for(;280>t;)e.lens[t++]=7;for(;288>t;)e.lens[t++]=8;for(w(A,e.lens,0,288,_,0,e.work,{bits:9}),t=0;32>t;)e.lens[t++]=5;w(T,e.lens,0,32,g,0,e.work,{bits:5}),yt=!1}e.lencode=_,e.lenbits=9,e.distcode=g,e.distbits=5}function f(e,t,r,n){var i,a=e.state;return null===a.window&&(a.wsize=1<<a.wbits,a.wnext=0,a.whave=0,a.window=new v.Buf8(a.wsize)),n>=a.wsize?(v.arraySet(a.window,t,r-a.wsize,a.wsize,0),a.wnext=0,a.whave=a.wsize):(i=a.wsize-a.wnext,i>n&&(i=n),v.arraySet(a.window,t,r-n,i,a.wnext),n-=i,n?(v.arraySet(a.window,t,r-n,n,0),a.wnext=n,a.whave=a.wsize):(a.wnext+=i,a.wnext===a.wsize&&(a.wnext=0),a.whave<a.wsize&&(a.whave+=i))),0}function h(e,t){var r,i,a,o,s,l,u,h,d,p,m,_,g,mt,_t,gt,vt,yt,bt,xt,wt,kt,At,Tt,Et=0,St=new v.Buf8(4),Rt=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];if(!e||!e.state||!e.output||!e.input&&0!==e.avail_in)return C;r=e.state,r.mode===X&&(r.mode=Y),s=e.next_out,a=e.output,u=e.avail_out,o=e.next_in,i=e.input,l=e.avail_in,h=r.hold,d=r.bits,p=l,m=u,kt=j;e:for(;;)switch(r.mode){case I:if(0===r.wrap){r.mode=Y;break}for(;16>d;){if(0===l)break e;l--,h+=i[o++]<<d,d+=8}if(2&r.wrap&&35615===h){r.check=0,St[0]=255&h,St[1]=h>>>8&255,r.check=b(r.check,St,2,0),h=0,d=0,r.mode=F;break}if(r.flags=0,r.head&&(r.head.done=!1),!(1&r.wrap)||(((255&h)<<8)+(h>>8))%31){e.msg="incorrect header check",r.mode=ht;break}if((15&h)!==O){e.msg="unknown compression method",r.mode=ht;break}if(h>>>=4,d-=4,wt=(15&h)+8,0===r.wbits)r.wbits=wt;else if(wt>r.wbits){e.msg="invalid window size",r.mode=ht;break}r.dmax=1<<wt,e.adler=r.check=1,r.mode=512&h?Z:X,h=0,d=0;break;case F:for(;16>d;){if(0===l)break e;l--,h+=i[o++]<<d,d+=8}if(r.flags=h,(255&r.flags)!==O){e.msg="unknown compression method",r.mode=ht;break}if(57344&r.flags){e.msg="unknown header flags set",r.mode=ht;break}r.head&&(r.head.text=h>>8&1),512&r.flags&&(St[0]=255&h,St[1]=h>>>8&255,r.check=b(r.check,St,2,0)),h=0,d=0,r.mode=U;case U:for(;32>d;){if(0===l)break e;l--,h+=i[o++]<<d,d+=8}r.head&&(r.head.time=h),512&r.flags&&(St[0]=255&h,St[1]=h>>>8&255,St[2]=h>>>16&255,St[3]=h>>>24&255,r.check=b(r.check,St,4,0)),h=0,d=0,r.mode=D;case D:for(;16>d;){if(0===l)break e;l--,h+=i[o++]<<d,d+=8}r.head&&(r.head.xflags=255&h,r.head.os=h>>8),512&r.flags&&(St[0]=255&h,St[1]=h>>>8&255,r.check=b(r.check,St,2,0)),h=0,d=0,r.mode=B;case B:if(1024&r.flags){for(;16>d;){if(0===l)break e;l--,h+=i[o++]<<d,d+=8}r.length=h,r.head&&(r.head.extra_len=h),512&r.flags&&(St[0]=255&h,St[1]=h>>>8&255,r.check=b(r.check,St,2,0)),h=0,d=0}else r.head&&(r.head.extra=null);r.mode=G;case G:if(1024&r.flags&&(_=r.length,_>l&&(_=l),_&&(r.head&&(wt=r.head.extra_len-r.length,r.head.extra||(r.head.extra=new Array(r.head.extra_len)),v.arraySet(r.head.extra,i,o,_,wt)),512&r.flags&&(r.check=b(r.check,i,_,o)),l-=_,o+=_,r.length-=_),r.length))break e;r.length=0,r.mode=V;case V:if(2048&r.flags){if(0===l)break e;_=0;do wt=i[o+_++],r.head&&wt&&r.length<65536&&(r.head.name+=String.fromCharCode(wt));while(wt&&l>_);if(512&r.flags&&(r.check=b(r.check,i,_,o)),l-=_,o+=_,wt)break e}else r.head&&(r.head.name=null);r.length=0,r.mode=W;case W:if(4096&r.flags){if(0===l)break e;_=0;do wt=i[o+_++],r.head&&wt&&r.length<65536&&(r.head.comment+=String.fromCharCode(wt));while(wt&&l>_);if(512&r.flags&&(r.check=b(r.check,i,_,o)),l-=_,o+=_,wt)break e}else r.head&&(r.head.comment=null);r.mode=q;case q:if(512&r.flags){for(;16>d;){if(0===l)break e;l--,h+=i[o++]<<d,d+=8}if(h!==(65535&r.check)){e.msg="header crc mismatch",r.mode=ht;break}h=0,d=0}r.head&&(r.head.hcrc=r.flags>>9&1,r.head.done=!0),e.adler=r.check=0,r.mode=X;break;case Z:for(;32>d;){if(0===l)break e;l--,h+=i[o++]<<d,d+=8}e.adler=r.check=n(h),h=0,d=0,r.mode=H;case H:if(0===r.havedict)return e.next_out=s,e.avail_out=u,e.next_in=o,e.avail_in=l,r.hold=h,r.bits=d,z;e.adler=r.check=1,r.mode=X;case X:if(t===S||t===R)break e;case Y:if(r.last){h>>>=7&d,d-=7&d,r.mode=ut;break}for(;3>d;){if(0===l)break e;l--,h+=i[o++]<<d,d+=8}switch(r.last=1&h,h>>>=1,d-=1,3&h){case 0:r.mode=J;break;case 1:if(c(r),r.mode=rt,t===R){h>>>=2,d-=2;break e}break;case 2:r.mode=Q;break;case 3:e.msg="invalid block type",r.mode=ht}h>>>=2,d-=2;break;case J:for(h>>>=7&d,d-=7&d;32>d;){if(0===l)break e;l--,h+=i[o++]<<d,d+=8}if((65535&h)!==(h>>>16^65535)){e.msg="invalid stored block lengths",r.mode=ht;break}if(r.length=65535&h,h=0,d=0,r.mode=K,t===R)break e;case K:r.mode=$;case $:if(_=r.length){if(_>l&&(_=l),_>u&&(_=u),0===_)break e;v.arraySet(a,i,o,_,s),l-=_,o+=_,u-=_,s+=_,r.length-=_;break}r.mode=X;break;case Q:for(;14>d;){if(0===l)break e;l--,h+=i[o++]<<d,d+=8}if(r.nlen=(31&h)+257,h>>>=5,d-=5,r.ndist=(31&h)+1,h>>>=5,d-=5,r.ncode=(15&h)+4,h>>>=4,d-=4,r.nlen>286||r.ndist>30){e.msg="too many length or distance symbols",r.mode=ht;break}r.have=0,r.mode=et;case et:for(;r.have<r.ncode;){for(;3>d;){if(0===l)break e;l--,h+=i[o++]<<d,d+=8}r.lens[Rt[r.have++]]=7&h,h>>>=3,d-=3}for(;r.have<19;)r.lens[Rt[r.have++]]=0;if(r.lencode=r.lendyn,r.lenbits=7,At={bits:r.lenbits},kt=w(k,r.lens,0,19,r.lencode,0,r.work,At),r.lenbits=At.bits,kt){e.msg="invalid code lengths set",r.mode=ht;break}r.have=0,r.mode=tt;case tt:for(;r.have<r.nlen+r.ndist;){for(;Et=r.lencode[h&(1<<r.lenbits)-1],_t=Et>>>24,gt=Et>>>16&255,vt=65535&Et,!(d>=_t);){if(0===l)break e;l--,h+=i[o++]<<d,d+=8}if(16>vt)h>>>=_t,d-=_t,r.lens[r.have++]=vt;else{if(16===vt){for(Tt=_t+2;Tt>d;){if(0===l)break e;l--,h+=i[o++]<<d,d+=8}if(h>>>=_t,d-=_t,0===r.have){e.msg="invalid bit length repeat",r.mode=ht;break}wt=r.lens[r.have-1],_=3+(3&h),h>>>=2,d-=2}else if(17===vt){for(Tt=_t+3;Tt>d;){if(0===l)break e;l--,h+=i[o++]<<d,d+=8}h>>>=_t,d-=_t,wt=0,_=3+(7&h),h>>>=3,d-=3}else{for(Tt=_t+7;Tt>d;){if(0===l)break e;l--,h+=i[o++]<<d,d+=8}h>>>=_t,d-=_t,wt=0,_=11+(127&h),h>>>=7,d-=7}if(r.have+_>r.nlen+r.ndist){e.msg="invalid bit length repeat",r.mode=ht;break}for(;_--;)r.lens[r.have++]=wt}}if(r.mode===ht)break;if(0===r.lens[256]){e.msg="invalid code -- missing end-of-block",r.mode=ht;break}if(r.lenbits=9,At={bits:r.lenbits},kt=w(A,r.lens,0,r.nlen,r.lencode,0,r.work,At),r.lenbits=At.bits,kt){e.msg="invalid literal/lengths set",r.mode=ht;break}if(r.distbits=6,r.distcode=r.distdyn,At={bits:r.distbits},kt=w(T,r.lens,r.nlen,r.ndist,r.distcode,0,r.work,At),r.distbits=At.bits,kt){e.msg="invalid distances set",r.mode=ht;break}if(r.mode=rt,t===R)break e;case rt:r.mode=nt;case nt:if(l>=6&&u>=258){e.next_out=s,e.avail_out=u,e.next_in=o,e.avail_in=l,r.hold=h,r.bits=d,x(e,m),s=e.next_out,a=e.output,u=e.avail_out,o=e.next_in,i=e.input,l=e.avail_in,h=r.hold,d=r.bits,r.mode===X&&(r.back=-1);break}for(r.back=0;Et=r.lencode[h&(1<<r.lenbits)-1],_t=Et>>>24,gt=Et>>>16&255,vt=65535&Et,!(d>=_t);){if(0===l)break e;l--,h+=i[o++]<<d,d+=8}if(gt&&0===(240>)){for(yt=_t,bt=gt,xt=vt;Et=r.lencode[xt+((h&(1<<yt+bt)-1)>>yt)],_t=Et>>>24,gt=Et>>>16&255,vt=65535&Et,!(d>=yt+_t);){if(0===l)break e;l--,h+=i[o++]<<d,d+=8}h>>>=yt,d-=yt,r.back+=yt}if(h>>>=_t,d-=_t,r.back+=_t,r.length=vt,0===gt){r.mode=lt;break}if(32>){r.back=-1,r.mode=X;break}if(64>){e.msg="invalid literal/length code",r.mode=ht;break}r.extra=15>,r.mode=it;case it:if(r.extra){for(Tt=r.extra;Tt>d;){if(0===l)break e;l--,h+=i[o++]<<d,d+=8}r.length+=h&(1<<r.extra)-1,h>>>=r.extra,d-=r.extra,r.back+=r.extra}r.was=r.length,r.mode=at;case at:for(;Et=r.distcode[h&(1<<r.distbits)-1],_t=Et>>>24,gt=Et>>>16&255,vt=65535&Et,!(d>=_t);){if(0===l)break e;l--,h+=i[o++]<<d,d+=8}if(0===(240>)){for(yt=_t,bt=gt,xt=vt;Et=r.distcode[xt+((h&(1<<yt+bt)-1)>>yt)],_t=Et>>>24,gt=Et>>>16&255,vt=65535&Et,!(d>=yt+_t);){if(0===l)break e;l--,h+=i[o++]<<d,d+=8}h>>>=yt,d-=yt,r.back+=yt}if(h>>>=_t,d-=_t,r.back+=_t,64>){e.msg="invalid distance code",r.mode=ht;break}r.offset=vt,r.extra=15>,r.mode=ot;case ot:if(r.extra){for(Tt=r.extra;Tt>d;){if(0===l)break e;l--,h+=i[o++]<<d,d+=8}r.offset+=h&(1<<r.extra)-1,h>>>=r.extra,d-=r.extra,r.back+=r.extra}if(r.offset>r.dmax){e.msg="invalid distance too far back",r.mode=ht;break}r.mode=st;case st:if(0===u)break e;if(_=m-u,r.offset>_){if(_=r.offset-_,_>r.whave&&r.sane){e.msg="invalid distance too far back",r.mode=ht;break}_>r.wnext?(_-=r.wnext,g=r.wsize-_):g=r.wnext-_,_>r.length&&(_=r.length),mt=r.window}else mt=a,g=s-r.offset,_=r.length;_>u&&(_=u),u-=_,r.length-=_;do a[s++]=mt[g++];while(--_);0===r.length&&(r.mode=nt);break;case lt:if(0===u)break e;a[s++]=r.length,u--,r.mode=nt;break;case ut:if(r.wrap){for(;32>d;){if(0===l)break e;l--,h|=i[o++]<<d,d+=8}if(m-=u,e.total_out+=m,r.total+=m,m&&(e.adler=r.check=r.flags?b(r.check,a,m,s-m):y(r.check,a,m,s-m)),m=u,(r.flags?h:n(h))!==r.check){e.msg="incorrect data check",r.mode=ht;break}h=0,d=0}r.mode=ct;case ct:if(r.wrap&&r.flags){for(;32>d;){if(0===l)break e;l--,h+=i[o++]<<d,d+=8}if(h!==(4294967295&r.total)){e.msg="incorrect length check",r.mode=ht;break}h=0,d=0}r.mode=ft;case ft:kt=M;break e;case ht:kt=P;break e;case dt:return N;case pt:default:return C}return e.next_out=s,e.avail_out=u,e.next_in=o,e.avail_in=l,r.hold=h,r.bits=d,(r.wsize||m!==e.avail_out&&r.mode<ht&&(r.mode<ut||t!==E))&&f(e,e.output,e.next_out,m-e.avail_out)?(r.mode=dt,N):(p-=e.avail_in,m-=e.avail_out,e.total_in+=p,e.total_out+=m,r.total+=m,r.wrap&&m&&(e.adler=r.check=r.flags?b(r.check,a,m,e.next_out-m):y(r.check,a,m,e.next_out-m)),e.data_type=r.bits+(r.last?64:0)+(r.mode===X?128:0)+(r.mode===rt||r.mode===K?256:0),(0===p&&0===m||t===E)&&kt===j&&(kt=L),kt)}function d(e){if(!e||!e.state)return C;var t=e.state;return t.window&&(t.window=null),e.state=null,j}function p(e,t){var r;return e&&e.state?(r=e.state,0===(2&r.wrap)?C:(r.head=t,t.done=!1,j)):C}function m(e,t){var r,n,i,a=t.length;return e&&e.state?(r=e.state,0!==r.wrap&&r.mode!==H?C:r.mode===H&&(n=1,n=y(n,t,a,0),n!==r.check)?P:(i=f(e,t,a,a))?(r.mode=dt,N):(r.havedict=1,j)):C}var _,g,v=e("../utils/common"),y=e("./adler32"),b=e("./crc32"),x=e("./inffast"),w=e("./inftrees"),k=0,A=1,T=2,E=4,S=5,R=6,j=0,M=1,z=2,C=-2,P=-3,N=-4,L=-5,O=8,I=1,F=2,U=3,D=4,B=5,G=6,V=7,W=8,q=9,Z=10,H=11,X=12,Y=13,J=14,K=15,$=16,Q=17,et=18,tt=19,rt=20,nt=21,it=22,at=23,ot=24,st=25,lt=26,ut=27,ct=28,ft=29,ht=30,dt=31,pt=32,mt=852,_t=592,gt=15,vt=gt,yt=!0;r.inflateReset=o,r.inflateReset2=s,r.inflateResetKeep=a,r.inflateInit=u,r.inflateInit2=l,r.inflate=h,r.inflateEnd=d,r.inflateGetHeader=p,r.inflateSetDictionary=m,r.inflateInfo="pako inflate (from Nodeca project)"},{"../utils/common":262,"./adler32":264,"./crc32":266,"./inffast":269,"./inftrees":271}],271:[function(e,t){"use strict";var r=e("../utils/common"),n=15,i=852,a=592,o=0,s=1,l=2,u=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0],c=[16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78],f=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0],h=[16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64];t.exports=function(e,t,d,p,m,_,g,v){var y,b,x,w,k,A,T,E,S,R=v.bits,j=0,M=0,z=0,C=0,P=0,N=0,L=0,O=0,I=0,F=0,U=null,D=0,B=new r.Buf16(n+1),G=new r.Buf16(n+1),V=null,W=0;for(j=0;n>=j;j++)B[j]=0;for(M=0;p>M;M++)B[t[d+M]]++;for(P=R,C=n;C>=1&&0===B[C];C--);if(P>C&&(P=C),0===C)return m[_++]=20971520,m[_++]=20971520,v.bits=1,0;for(z=1;C>z&&0===B[z];z++);for(z>P&&(P=z),O=1,j=1;n>=j;j++)if(O<<=1,O-=B[j],0>O)return-1;if(O>0&&(e===o||1!==C))return-1;for(G[1]=0,j=1;n>j;j++)G[j+1]=G[j]+B[j];for(M=0;p>M;M++)0!==t[d+M]&&(g[G[t[d+M]]++]=M);if(e===o?(U=V=g,A=19):e===s?(U=u,D-=257,V=c,W-=257,A=256):(U=f,V=h,A=-1),F=0,M=0,j=z,k=_,N=P,L=0,x=-1,I=1<<P,w=I-1,e===s&&I>i||e===l&&I>a)return 1;for(var q=0;;){q++,T=j-L,g[M]<A?(E=0,S=g[M]):g[M]>A?(E=V[W+g[M]],S=U[D+g[M]]):(E=96,S=0),y=1<<j-L,b=1<<N,z=b;do b-=y,m[k+(F>>L)+b]=T<<24|E<<16|S|0;while(0!==b);for(y=1<<j-1;F&y;)y>>=1;if(0!==y?(F&=y-1,F+=y):F=0,M++,0===--B[j]){if(j===C)break;j=t[d+g[M]]}if(j>P&&(F&w)!==x){for(0===L&&(L=P),k+=z,N=j-L,O=1<<N;C>N+L&&(O-=B[N+L],!(0>=O));)N++,O<<=1;if(I+=1<<N,e===s&&I>i||e===l&&I>a)return 1;x=F&w,m[x]=P<<24|N<<16|k-_|0}}return 0!==F&&(m[k+F]=j-L<<24|64<<16|0),v.bits=P,0}},{"../utils/common":262}],272:[function(e,t){"use strict";t.exports={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"}},{}],273:[function(e,t,r){"use strict";function n(e){for(var t=e.length;--t>=0;)e[t]=0}function i(e,t,r,n,i){this.static_tree=e,this.extra_bits=t,this.extra_base=r,this.elems=n,this.max_length=i,this.has_stree=e&&e.length}function a(e,t){this.dyn_tree=e,this.max_code=0,this.stat_desc=t}function o(e){return 256>e?lt[e]:lt[256+(e>>>7)]}function s(e,t){e.pending_buf[e.pending++]=255&t,e.pending_buf[e.pending++]=t>>>8&255}function l(e,t,r){e.bi_valid>Y-r?(e.bi_buf|=t<<e.bi_valid&65535,s(e,e.bi_buf),e.bi_buf=t>>Y-e.bi_valid,e.bi_valid+=r-Y):(e.bi_buf|=t<<e.bi_valid&65535,e.bi_valid+=r)}function u(e,t,r){l(e,r[2*t],r[2*t+1])}function c(e,t){var r=0;do r|=1&e,e>>>=1,r<<=1;while(--t>0);return r>>>1}function f(e){16===e.bi_valid?(s(e,e.bi_buf),e.bi_buf=0,e.bi_valid=0):e.bi_valid>=8&&(e.pending_buf[e.pending++]=255&e.bi_buf,e.bi_buf>>=8,e.bi_valid-=8)}function h(e,t){var r,n,i,a,o,s,l=t.dyn_tree,u=t.max_code,c=t.stat_desc.static_tree,f=t.stat_desc.has_stree,h=t.stat_desc.extra_bits,d=t.stat_desc.extra_base,p=t.stat_desc.max_length,m=0;for(a=0;X>=a;a++)e.bl_count[a]=0;for(l[2*e.heap[e.heap_max]+1]=0,r=e.heap_max+1;H>r;r++)n=e.heap[r],a=l[2*l[2*n+1]+1]+1,a>p&&(a=p,m++),l[2*n+1]=a,n>u||(e.bl_count[a]++,o=0,n>=d&&(o=h[n-d]),s=l[2*n],e.opt_len+=s*(a+o),f&&(e.static_len+=s*(c[2*n+1]+o)));if(0!==m){do{for(a=p-1;0===e.bl_count[a];)a--;e.bl_count[a]--,e.bl_count[a+1]+=2,e.bl_count[p]--,m-=2}while(m>0);for(a=p;0!==a;a--)for(n=e.bl_count[a];0!==n;)i=e.heap[--r],i>u||(l[2*i+1]!==a&&(e.opt_len+=(a-l[2*i+1])*l[2*i],l[2*i+1]=a),n--)}}function d(e,t,r){var n,i,a=new Array(X+1),o=0;for(n=1;X>=n;n++)a[n]=o=o+r[n-1]<<1;for(i=0;t>=i;i++){var s=e[2*i+1];0!==s&&(e[2*i]=c(a[s]++,s))}}function p(){var e,t,r,n,a,o=new Array(X+1);for(r=0,n=0;G-1>n;n++)for(ct[n]=r,e=0;e<1<<tt[n];e++)ut[r++]=n;for(ut[r-1]=n,a=0,n=0;16>n;n++)for(ft[n]=a,e=0;e<1<<rt[n];e++)lt[a++]=n;for(a>>=7;q>n;n++)for(ft[n]=a<<7,e=0;e<1<<rt[n]-7;e++)lt[256+a++]=n;for(t=0;X>=t;t++)o[t]=0;for(e=0;143>=e;)ot[2*e+1]=8,e++,o[8]++;for(;255>=e;)ot[2*e+1]=9,e++,o[9]++;for(;279>=e;)ot[2*e+1]=7,e++,o[7]++;for(;287>=e;)ot[2*e+1]=8,e++,o[8]++;for(d(ot,W+1,o),e=0;q>e;e++)st[2*e+1]=5,st[2*e]=c(e,5);ht=new i(ot,tt,V+1,W,X),dt=new i(st,rt,0,q,X),pt=new i(new Array(0),nt,0,Z,J)}function m(e){var t;for(t=0;W>t;t++)e.dyn_ltree[2*t]=0;for(t=0;q>t;t++)e.dyn_dtree[2*t]=0;for(t=0;Z>t;t++)e.bl_tree[2*t]=0;e.dyn_ltree[2*K]=1,e.opt_len=e.static_len=0,e.last_lit=e.matches=0}function _(e){e.bi_valid>8?s(e,e.bi_buf):e.bi_valid>0&&(e.pending_buf[e.pending++]=e.bi_buf),e.bi_buf=0,e.bi_valid=0}function g(e,t,r,n){_(e),n&&(s(e,r),s(e,~r)),C.arraySet(e.pending_buf,e.window,t,r,e.pending),e.pending+=r}function v(e,t,r,n){var i=2*t,a=2*r;return e[i]<e[a]||e[i]===e[a]&&n[t]<=n[r]}function y(e,t,r){for(var n=e.heap[r],i=r<<1;i<=e.heap_len&&(i<e.heap_len&&v(t,e.heap[i+1],e.heap[i],e.depth)&&i++,!v(t,n,e.heap[i],e.depth));)e.heap[r]=e.heap[i],r=i,i<<=1;e.heap[r]=n}function b(e,t,r){var n,i,a,s,c=0;if(0!==e.last_lit)do n=e.pending_buf[e.d_buf+2*c]<<8|e.pending_buf[e.d_buf+2*c+1],i=e.pending_buf[e.l_buf+c],c++,0===n?u(e,i,t):(a=ut[i],u(e,a+V+1,t),s=tt[a],0!==s&&(i-=ct[a],l(e,i,s)),n--,a=o(n),u(e,a,r),s=rt[a],0!==s&&(n-=ft[a],l(e,n,s)));while(c<e.last_lit);u(e,K,t)}function x(e,t){var r,n,i,a=t.dyn_tree,o=t.stat_desc.static_tree,s=t.stat_desc.has_stree,l=t.stat_desc.elems,u=-1;for(e.heap_len=0,e.heap_max=H,r=0;l>r;r++)0!==a[2*r]?(e.heap[++e.heap_len]=u=r,e.depth[r]=0):a[2*r+1]=0;for(;e.heap_len<2;)i=e.heap[++e.heap_len]=2>u?++u:0,a[2*i]=1,e.depth[i]=0,e.opt_len--,s&&(e.static_len-=o[2*i+1]);for(t.max_code=u,r=e.heap_len>>1;r>=1;r--)y(e,a,r);i=l;do r=e.heap[1],e.heap[1]=e.heap[e.heap_len--],y(e,a,1),n=e.heap[1],e.heap[--e.heap_max]=r,e.heap[--e.heap_max]=n,a[2*i]=a[2*r]+a[2*n],e.depth[i]=(e.depth[r]>=e.depth[n]?e.depth[r]:e.depth[n])+1,a[2*r+1]=a[2*n+1]=i,e.heap[1]=i++,y(e,a,1);while(e.heap_len>=2);e.heap[--e.heap_max]=e.heap[1],h(e,t),d(a,u,e.bl_count)}function w(e,t,r){var n,i,a=-1,o=t[1],s=0,l=7,u=4;for(0===o&&(l=138,u=3),t[2*(r+1)+1]=65535,n=0;r>=n;n++)i=o,o=t[2*(n+1)+1],++s<l&&i===o||(u>s?e.bl_tree[2*i]+=s:0!==i?(i!==a&&e.bl_tree[2*i]++,e.bl_tree[2*$]++):10>=s?e.bl_tree[2*Q]++:e.bl_tree[2*et]++,s=0,a=i,0===o?(l=138,u=3):i===o?(l=6,u=3):(l=7,u=4))}function k(e,t,r){var n,i,a=-1,o=t[1],s=0,c=7,f=4;for(0===o&&(c=138,f=3),n=0;r>=n;n++)if(i=o,o=t[2*(n+1)+1],!(++s<c&&i===o)){if(f>s){do u(e,i,e.bl_tree);while(0!==--s)}else 0!==i?(i!==a&&(u(e,i,e.bl_tree),s--),u(e,$,e.bl_tree),l(e,s-3,2)):10>=s?(u(e,Q,e.bl_tree),l(e,s-3,3)):(u(e,et,e.bl_tree),l(e,s-11,7));s=0,a=i,0===o?(c=138,f=3):i===o?(c=6,f=3):(c=7,f=4)}}function A(e){var t;for(w(e,e.dyn_ltree,e.l_desc.max_code),w(e,e.dyn_dtree,e.d_desc.max_code),x(e,e.bl_desc),t=Z-1;t>=3&&0===e.bl_tree[2*it[t]+1];t--);return e.opt_len+=3*(t+1)+5+5+4,t}function T(e,t,r,n){var i;for(l(e,t-257,5),l(e,r-1,5),l(e,n-4,4),i=0;n>i;i++)l(e,e.bl_tree[2*it[i]+1],3);k(e,e.dyn_ltree,t-1),k(e,e.dyn_dtree,r-1)}function E(e){var t,r=4093624447;for(t=0;31>=t;t++,r>>>=1)if(1&r&&0!==e.dyn_ltree[2*t])return N;if(0!==e.dyn_ltree[18]||0!==e.dyn_ltree[20]||0!==e.dyn_ltree[26])return L;for(t=32;V>t;t++)if(0!==e.dyn_ltree[2*t])return L;return N}function S(e){mt||(p(),mt=!0),e.l_desc=new a(e.dyn_ltree,ht),e.d_desc=new a(e.dyn_dtree,dt),e.bl_desc=new a(e.bl_tree,pt),e.bi_buf=0,e.bi_valid=0,m(e)}function R(e,t,r,n){l(e,(I<<1)+(n?1:0),3),g(e,t,r,!0)}function j(e){l(e,F<<1,3),u(e,K,ot),f(e)}function M(e,t,r,n){var i,a,o=0;e.level>0?(e.strm.data_type===O&&(e.strm.data_type=E(e)),x(e,e.l_desc),x(e,e.d_desc),o=A(e),i=e.opt_len+3+7>>>3,a=e.static_len+3+7>>>3,i>=a&&(i=a)):i=a=r+5,i>=r+4&&-1!==t?R(e,t,r,n):e.strategy===P||a===i?(l(e,(F<<1)+(n?1:0),3),b(e,ot,st)):(l(e,(U<<1)+(n?1:0),3),T(e,e.l_desc.max_code+1,e.d_desc.max_code+1,o+1),b(e,e.dyn_ltree,e.dyn_dtree)),m(e),n&&_(e)}function z(e,t,r){return e.pending_buf[e.d_buf+2*e.last_lit]=t>>>8&255,e.pending_buf[e.d_buf+2*e.last_lit+1]=255&t,e.pending_buf[e.l_buf+e.last_lit]=255&r,e.last_lit++,0===t?e.dyn_ltree[2*r]++:(e.matches++,t--,e.dyn_ltree[2*(ut[r]+V+1)]++,e.dyn_dtree[2*o(t)]++),e.last_lit===e.lit_bufsize-1 9 }var C=e("../utils/common"),P=4,N=0,L=1,O=2,I=0,F=1,U=2,D=3,B=258,G=29,V=256,W=V+1+G,q=30,Z=19,H=2*W+1,X=15,Y=16,J=7,K=256,$=16,Q=17,et=18,tt=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0],rt=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13],nt=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],it=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],at=512,ot=new Array(2*(W+2));n(ot);var st=new Array(2*q);n(st);var lt=new Array(at);n(lt);var ut=new Array(B-D+1);n(ut);var ct=new Array(G);n(ct);var ft=new Array(q);n(ft);var ht,dt,pt,mt=!1;r._tr_init=S,r._tr_stored_block=R,r._tr_flush_block=M,r._tr_tally=z,r._tr_align=j},{"../utils/common":262}],274:[function(e,t){"use strict";function r(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}t.exports=r},{}],275:[function(e,t){"use strict";function r(e){var t;e&&e.length&&(t=e,e=t.length);var r=new Uint8Array(e||0);return t&&r.set(t),r.readUInt32LE=i.readUInt32LE,r.writeUInt32LE=i.writeUInt32LE,r.readInt32LE=i.readInt32LE,r.writeInt32LE=i.writeInt32LE,r.readFloatLE=i.readFloatLE,r.writeFloatLE=i.writeFloatLE,r.readDoubleLE=i.readDoubleLE,r.writeDoubleLE=i.writeDoubleLE,r.toString=i.toString,r.write=i.write,r.slice=i.slice,r.copy=i.copy,r._isBuffer=!0,r}function n(e){for(var t,r,n=e.length,i=[],a=0;n>a;a++){if(t=e.charCodeAt(a),t>55295&&57344>t){if(!r){t>56319||a+1===n?i.push(239,191,189):r=t;continue}if(56320>t){i.push(239,191,189),r=t;continue}t=r-55296<<10|t-56320|65536,r=null}else r&&(i.push(239,191,189),r=null);128>t?i.push(t):2048>t?i.push(t>>6|192,63&t|128):65536>t?i.push(t>>12|224,t>>6&63|128,63&t|128):i.push(t>>18|240,t>>12&63|128,t>>6&63|128,63&t|128)}return i}t.exports=r;var i,a,o,s=e("ieee754");i={readUInt32LE:function(e){return(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},writeUInt32LE:function(e,t){this[t]=e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24},readInt32LE:function(e){return(this[e]|this[e+1]<<8|this[e+2]<<16)+(this[e+3]<<24)},readFloatLE:function(e){return s.read(this,e,!0,23,4)},readDoubleLE:function(e){return s.read(this,e,!0,52,8)},writeFloatLE:function(e,t){return s.write(this,e,t,!0,23,4)},writeDoubleLE:function(e,t){return s.write(this,e,t,!0,52,8)},toString:function(e,t,r){var n="",i="";t=t||0,r=Math.min(this.length,r||this.length);for(var a=t;r>a;a++){var o=this[a];127>=o?(n+=decodeURIComponent(i)+String.fromCharCode(o),i=""):i+="%"+o.toString(16)}return n+=decodeURIComponent(i)},write:function(e,t){for(var r=e===a?o:n(e),i=0;i<r.length;i++)this[t+i]=r[i]},slice:function(e,t){return this.subarray(e,t)},copy:function(e,t){t=t||0;for(var r=0;r<this.length;r++)e[t+r]=this[r]}},i.writeInt32LE=i.writeUInt32LE,r.byteLength=function(e){return a=e,o=n(e),o.length},r.isBuffer=function(e){return!(!e||!e._isBuffer)}},{ieee754:186}],276:[function(e,t){(function(r){"use strict";function n(e){this.buf=d.isBuffer(e)?e:new d(e||0),this.pos=0,this.length=this.buf.length}function i(e,t){for(var r=0;r<e.length;r++)t.writeVarint(e[r])}function a(e,t){for(var r=0;r<e.length;r++)t.writeSVarint(e[r])}function o(e,t){for(var r=0;r<e.length;r++)t.writeFloat(e[r])}function s(e,t){for(var r=0;r<e.length;r++)t.writeDouble(e[r])}function l(e,t){for(var r=0;r<e.length;r++)t.writeBoolean(e[r])}function u(e,t){for(var r=0;r<e.length;r++)t.writeFixed32(e[r])}function c(e,t){for(var r=0;r<e.length;r++)t.writeSFixed32(e[r])}function f(e,t){for(var r=0;r<e.length;r++)t.writeFixed64(e[r])}function h(e,t){for(var r=0;r<e.length;r++)t.writeSFixed64(e[r])}t.exports=n;var d=r.Buffer||e("./buffer");n.Varint=0,n.Fixed64=1,n.Bytes=2,n.Fixed32=5;var p=4294967296,m=1/p,_=Math.pow(2,63);n.prototype={destroy:function(){this.buf=null},readFields:function(e,t,r){for(r=r||this.length;this.pos<r;){var n=this.readVarint(),i=n>>3,a=this.pos;e(i,t,this),this.pos===a&&this.skip(n)}return t},readMessage:function(e,t){return this.readFields(e,t,this.readVarint()+this.pos)},readFixed32:function(){var e=this.buf.readUInt32LE(this.pos);return this.pos+=4,e},readSFixed32:function(){var e=this.buf.readInt32LE(this.pos);return this.pos+=4,e},readFixed64:function(){var e=this.buf.readUInt32LE(this.pos)+this.buf.readUInt32LE(this.pos+4)*p;return this.pos+=8,e},readSFixed64:function(){var e=this.buf.readUInt32LE(this.pos)+this.buf.readInt32LE(this.pos+4)*p;return this.pos+=8,e},readFloat:function(){var e=this.buf.readFloatLE(this.pos);return this.pos+=4,e},readDouble:function(){var e=this.buf.readDoubleLE(this.pos);return this.pos+=8,e},readVarint:function(){var e,t,r,n,i,a,o=this.buf;if(r=o[this.pos++],128>r)return r;if(r=127&r,n=o[this.pos++],128>n)return r|n<<7;if(n=(127&n)<<7,i=o[this.pos++],128>i)return r|n|i<<14;if(i=(127&i)<<14,a=o[this.pos++],128>a)return r|n|i|a<<21;if(e=r|n|i|(127&a)<<21,t=o[this.pos++],e+=268435456*(127&t),128>t)return e;if(t=o[this.pos++],e+=34359738368*(127&t),128>t)return e;if(t=o[this.pos++],e+=4398046511104*(127&t),128>t)return e;if(t=o[this.pos++],e+=562949953421312*(127&t),128>t)return e;if(t=o[this.pos++],e+=72057594037927940*(127&t),128>t)return e;if(t=o[this.pos++],e+=0x8000000000000000*(127&t),128>t)return e;throw new Error("Expected varint not more than 10 bytes")},readVarint64:function(){var e=this.pos,t=this.readVarint();if(_>t)return t;for(var r=this.pos-2;255===this.buf[r];)r--;e>r&&(r=e),t=0;for(var n=0;r-e+1>n;n++){var i=127&~this.buf[e+n];t+=4>n?i<<7*n:i*Math.pow(2,7*n)}return-t-1},readSVarint:function(){var e=this.readVarint();return e%2===1?(e+1)/-2:e/2},readBoolean:function(){return Boolean(this.readVarint())},readString:function(){var e=this.readVarint()+this.pos,t=this.buf.toString("utf8",this.pos,e);return this.pos=e,t},readBytes:function(){var e=this.readVarint()+this.pos,t=this.buf.slice(this.pos,e);return this.pos=e,t},readPackedVarint:function(){for(var e=this.readVarint()+this.pos,t=[];this.pos<e;)t.push(this.readVarint());return t},readPackedSVarint:function(){for(var e=this.readVarint()+this.pos,t=[];this.pos<e;)t.push(this.readSVarint());return t},readPackedBoolean:function(){for(var e=this.readVarint()+this.pos,t=[];this.pos<e;)t.push(this.readBoolean());return t},readPackedFloat:function(){for(var e=this.readVarint()+this.pos,t=[];this.pos<e;)t.push(this.readFloat());return t},readPackedDouble:function(){for(var e=this.readVarint()+this.pos,t=[];this.pos<e;)t.push(this.readDouble());return t},readPackedFixed32:function(){for(var e=this.readVarint()+this.pos,t=[];this.pos<e;)t.push(this.readFixed32());return t},readPackedSFixed32:function(){for(var e=this.readVarint()+this.pos,t=[];this.pos<e;)t.push(this.readSFixed32());return t},readPackedFixed64:function(){for(var e=this.readVarint()+this.pos,t=[];this.pos<e;)t.push(this.readFixed64());return t},readPackedSFixed64:function(){for(var e=this.readVarint()+this.pos,t=[];this.pos<e;)t.push(this.readSFixed64());return t},skip:function(e){var t=7&e;if(t===n.Varint)for(;this.buf[this.pos++]>127;);else if(t===n.Bytes)this.pos=this.readVarint()+this.pos;else if(t===n.Fixed32)this.pos+=4;else{if(t!==n.Fixed64)throw new Error("Unimplemented type: "+t);this.pos+=8}},writeTag:function(e,t){this.writeVarint(e<<3|t)},realloc:function(e){for(var t=this.length||16;t<this.pos+e;)t*=2;if(t!==this.length){var r=new d(t);this.buf.copy(r),this.buf=r,this.length=t}},finish:function(){return this.length=this.pos,this.pos=0,this.buf.slice(0,this.length)},writeFixed32:function(e){this.realloc(4),this.buf.writeUInt32LE(e,this.pos),this.pos+=4},writeSFixed32:function(e){this.realloc(4),this.buf.writeInt32LE(e,this.pos),this.pos+=4},writeFixed64:function(e){this.realloc(8),this.buf.writeInt32LE(-1&e,this.pos),this.buf.writeUInt32LE(Math.floor(e*m),this.pos+4),this.pos+=8},writeSFixed64:function(e){this.realloc(8),this.buf.writeInt32LE(-1&e,this.pos),this.buf.writeInt32LE(Math.floor(e*m),this.pos+4),this.pos+=8},writeVarint:function(e){if(e=+e,127>=e)this.realloc(1),this.buf[this.pos++]=e;else if(16383>=e)this.realloc(2),this.buf[this.pos++]=e>>>0&127|128,this.buf[this.pos++]=e>>>7&127;else if(2097151>=e)this.realloc(3),this.buf[this.pos++]=e>>>0&127|128,this.buf[this.pos++]=e>>>7&127|128,this.buf[this.pos++]=e>>>14&127;else if(268435455>=e)this.realloc(4),this.buf[this.pos++]=e>>>0&127|128,this.buf[this.pos++]=e>>>7&127|128,this.buf[this.pos++]=e>>>14&127|128,this.buf[this.pos++]=e>>>21&127;else{for(var t=this.pos;e>=128;)this.realloc(1),this.buf[this.pos++]=255&e|128,e/=128;if(this.realloc(1),this.buf[this.pos++]=0|e,this.pos-t>10)throw new Error("Given varint doesn't fit into 10 bytes")}},writeSVarint:function(e){this.writeVarint(0>e?2*-e-1:2*e)},writeBoolean:function(e){this.writeVarint(Boolean(e))},writeString:function(e){e=String(e);var t=d.byteLength(e);this.writeVarint(t),this.realloc(t),this.buf.write(e,this.pos),this.pos+=t},writeFloat:function(e){this.realloc(4),this.buf.writeFloatLE(e,this.pos),this.pos+=4},writeDouble:function(e){this.realloc(8),this.buf.writeDoubleLE(e,this.pos),this.pos+=8},writeBytes:function(e){var t=e.length;this.writeVarint(t),this.realloc(t);for(var r=0;t>r;r++)this.buf[this.pos++]=e[r]},writeMessage:function(e,t,r){this.writeTag(e,n.Bytes),this.pos++;var i=this.pos;t(r,this);var a=this.pos-i,o=127>=a?1:16383>=a?2:2097151>=a?3:268435455>=a?4:Math.ceil(Math.log(a)/(7*Math.LN2));if(o>1){this.realloc(o-1);for(var s=this.pos-1;s>=i;s--)this.buf[s+o-1]=this.buf[s]}this.pos=i-1,this.writeVarint(a),this.pos+=a},writePackedVarint:function(e,t){this.writeMessage(e,i,t)},writePackedSVarint:function(e,t){this.writeMessage(e,a,t)},writePackedBoolean:function(e,t){this.writeMessage(e,l,t)},writePackedFloat:function(e,t){this.writeMessage(e,o,t)},writePackedDouble:function(e,t){this.writeMessage(e,s,t)},writePackedFixed32:function(e,t){this.writeMessage(e,u,t)},writePackedSFixed32:function(e,t){this.writeMessage(e,c,t)},writePackedFixed64:function(e,t){this.writeMessage(e,f,t)},writePackedSFixed64:function(e,t){this.writeMessage(e,h,t)},writeBytesField:function(e,t){this.writeTag(e,n.Bytes),this.writeBytes(t)},writeFixed32Field:function(e,t){this.writeTag(e,n.Fixed32),this.writeFixed32(t)},writeSFixed32Field:function(e,t){this.writeTag(e,n.Fixed32),this.writeSFixed32(t)},writeFixed64Field:function(e,t){this.writeTag(e,n.Fixed64),this.writeFixed64(t)},writeSFixed64Field:function(e,t){this.writeTag(e,n.Fixed64),this.writeSFixed64(t)},writeVarintField:function(e,t){this.writeTag(e,n.Varint),this.writeVarint(t)},writeSVarintField:function(e,t){this.writeTag(e,n.Varint),this.writeSVarint(t)},writeStringField:function(e,t){this.writeTag(e,n.Bytes),this.writeString(t)},writeFloatField:function(e,t){this.writeTag(e,n.Fixed32),this.writeFloat(t)},writeDoubleField:function(e,t){this.writeTag(e,n.Fixed64),this.writeDouble(t)},writeBooleanField:function(e,t){this.writeVarintField(e,Boolean(t))}}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./buffer":275}],277:[function(e,t){"use strict";function r(e,t){this.x=e,this.y=t}t.exports=r,r.prototype={clone:function(){return new r(this.x,this.y)},add:function(e){return this.clone()._add(e)},sub:function(e){return this.clone()._sub(e)},mult:function(e){return this.clone()._mult(e)},div:function(e){return this.clone()._div(e)},rotate:function(e){return this.clone()._rotate(e)},matMult:function(e){return this.clone()._matMult(e)},unit:function(){return this.clone()._unit()},perp:function(){return this.clone()._perp()},round:function(){return this.clone()._round()},mag:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},equals:function(e){return this.x===e.x&&this.y===e.y},dist:function(e){return Math.sqrt(this.distSqr(e))},distSqr:function(e){var t=e.x-this.x,r=e.y-this.y;return t*t+r*r},angle:function(){return Math.atan2(this.y,this.x)},angleTo:function(e){return Math.atan2(this.y-e.y,this.x-e.x)},angleWith:function(e){return this.angleWithSep(e.x,e.y)},angleWithSep:function(e,t){return Math.atan2(this.x*t-this.y*e,this.x*e+this.y*t)},_matMult:function(e){var t=e[0]*this.x+e[1]*this.y,r=e[2]*this.x+e[3]*this.y;return this.x=t,this.y=r,this},_add:function(e){return this.x+=e.x,this.y+=e.y,this},_sub:function(e){return this.x-=e.x,this.y-=e.y,this},_mult:function(e){return this.x*=e,this.y*=e,this},_div:function(e){return this.x/=e,this.y/=e,this},_unit:function(){return this._div(this.mag()),this},_perp:function(){var e=this.y;return this.y=this.x,this.x=-e,this},_rotate:function(e){var t=Math.cos(e),r=Math.sin(e),n=t*this.x-r*this.y,i=r*this.x+t*this.y;return this.x=n,this.y=i,this},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}},r.convert=function(e){return e instanceof r?e:Array.isArray(e)?new r(e[0],e[1]):e}},{}],278:[function(e,t){(function(e){"use strict";function r(t,r,n,i){if("function"!=typeof t)throw new TypeError('"callback" argument must be a function');var a,o,s=arguments.length;switch(s){case 0:case 1:return e.nextTick(t);case 2:return e.nextTick(function(){t.call(null,r)});case 3:return e.nextTick(function(){t.call(null,r,n)});case 4:return e.nextTick(function(){t.call(null,r,n,i)});default:for(a=new Array(s-1),o=0;o<a.length;)a[o++]=arguments[o];return e.nextTick(function(){t.apply(null,a)})}}t.exports=!e.version||0===e.version.indexOf("v0.")||0===e.version.indexOf("v1.")&&0!==e.version.indexOf("v1.8.")?r:e.nextTick}).call(this,e("_process"))},{_process:279}],279:[function(e,t){function r(){throw new Error("setTimeout has not been defined")}function n(){throw new Error("clearTimeout has not been defined")}function i(e){if(c===setTimeout)return setTimeout(e,0);if((c===r||!c)&&setTimeout)return c=setTimeout,setTimeout(e,0);try{return c(e,0)}catch(t){try{return c.call(null,e,0)}catch(t){return c.call(this,e,0)}}}function a(e){if(f===clearTimeout)return clearTimeout(e);if((f===n||!f)&&clearTimeout)return f=clearTimeout,clearTimeout(e);try{return f(e)}catch(t){try{return f.call(null,e)}catch(t){return f.call(this,e)}}}function o(){m&&d&&(m=!1,d.length?p=d.concat(p):_=-1,p.length&&s())}function s(){if(!m){var e=i(o);m=!0;for(var t=p.length;t;){for(d=p,p=[];++_<t;)d&&d[_].run();_=-1,t=p.length}d=null,m=!1,a(e)}}function l(e,t){this.fun=e,this.array=t}function u(){}var c,f,h=t.exports={};!function(){try{c="function"==typeof setTimeout?setTimeout:r}catch(e){c=r}try{f="function"==typeof clearTimeout?clearTimeout:n}catch(e){f=n}}();var d,p=[],m=!1,_=-1;h.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)t[r-1]=arguments[r];p.push(new l(e,t)),1!==p.length||m||i(s)},l.prototype.run=function(){this.fun.apply(null,this.array)},h.title="browser",h.browser=!0,h.env={},h.argv=[],h.version="",h.versions={},h.on=u,h.addListener=u,h.once=u,h.off=u,h.removeListener=u,h.removeAllListeners=u,h.emit=u,h.binding=function(){throw new Error("process.binding is not supported")},h.cwd=function(){return"/"},h.chdir=function(){throw new Error("process.chdir is not supported")},h.umask=function(){return 0}},{}],280:[function(e,t){(function(r){var n="object"==typeof r?r:"object"==typeof window?window:"object"==typeof self?self:this,i=n.regeneratorRuntime&&Object.getOwnPropertyNames(n).indexOf("regeneratorRuntime")>=0,a=i&&n.regeneratorRuntime;if(n.regeneratorRuntime=void 0,t.exports=e("./runtime"),i)n.regeneratorRuntime=a;else try{delete n.regeneratorRuntime}catch(o){n.regeneratorRuntime=void 0}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./runtime":281}],281:[function(e,t){(function(e,r){!function(r){"use strict";function n(e,t,r,n){var i=Object.create((t||a).prototype),o=new p(n||[]);return i._invoke=f(e,r,o),i}function i(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(n){return{type:"throw",arg:n}}}function a(){}function o(){}function s(){}function l(e){["next","throw","return"].forEach(function(t){e[t]=function(e){return this._invoke(t,e)}})}function u(e){this.arg=e}function c(t){function r(e,n,a,o){var s=i(t[e],t,n);if("throw"!==s.type){var l=s.arg,c=l.value;return c instanceof u?Promise.resolve(c.arg).then(function(e){r("next",e,a,o)},function(e){r("throw",e,a,o)}):Promise.resolve(c).then(function(e){l.value=e,a(l)},o)}o(s.arg)}function n(e,t){function n(){return new Promise(function(n,i){r(e,t,n,i)})}return a=a?a.then(n,n):n()}"object"==typeof e&&e.domain&&(r=e.domain.bind(r));var a;this._invoke=n}function f(e,t,r){var n=A;return function(a,o){if(n===E)throw new Error("Generator is already running");if(n===S){if("throw"===a)throw o;return _()}for(;;){var s=r.delegate;if(s){if("return"===a||"throw"===a&&s.iterator[a]===g){r.delegate=null;var l=s.iterator["return"];if(l){var u=i(l,s.iterator,o);if("throw"===u.type){a="throw",o=u.arg;continue}}if("return"===a)continue}var u=i(s.iterator[a],s.iterator,o);if("throw"===u.type){r.delegate=null,a="throw",o=u.arg;continue}a="next",o=g;var c=u.arg;if(!c.done)return n=T,c;r[s.resultName]=c.value,r.next=s.nextLoc,r.delegate=null}if("next"===a)r.sent=r._sent=o;else if("throw"===a){if(n===A)throw n=S,o;r.dispatchException(o)&&(a="next",o=g)}else"return"===a&&r.abrupt("return",o);n=E;var u=i(e,t,r);if("normal"===u.type){n=r.done?S:T;var c={value:u.arg,done:r.done};if(u.arg!==R)return c;r.delegate&&"next"===a&&(o=g)}else"throw"===u.type&&(n=S,a="throw",o=u.arg)}}}function h(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function d(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function p(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(h,this),this.reset(!0)}function m(e){if(e){var t=e[b];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var r=-1,n=function i(){for(;++r<e.length;)if(v.call(e,r))return i.value=e[r],i.done=!1,i;return i.value=g,i.done=!0,i};return n.next=n}}return{next:_}}function _(){return{value:g,done:!0}}var g,v=Object.prototype.hasOwnProperty,y="function"==typeof Symbol?Symbol:{},b=y.iterator||"@@iterator",x=y.toStringTag||"@@toStringTag",w="object"==typeof t,k=r.regeneratorRuntime;if(k)return void(w&&(t.exports=k));k=r.regeneratorRuntime=w?t.exports:{},k.wrap=n;var A="suspendedStart",T="suspendedYield",E="executing",S="completed",R={},j=s.prototype=a.prototype;o.prototype=j.constructor=s,s.constructor=o,s[x]=o.displayName="GeneratorFunction",k.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return t?t===o||"GeneratorFunction"===(t.displayName||t.name):!1},k.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,s):(e.__proto__=s,x in e||(e[x]="GeneratorFunction")),e.prototype=Object.create(j),e},k.awrap=function(e){return new u(e)},l(c.prototype),k.async=function(e,t,r,i){var a=new c(n(e,t,r,i));return k.isGeneratorFunction(t)?a:a.next().then(function(e){return e.done?e.value:a.next()})},l(j),j[b]=function(){return this},j[x]="Generator",j.toString=function(){return"[object Generator]"},k.keys=function(e){var t=[];for(var r in e)t.push(r);return t.reverse(),function n(){for(;t.length;){var r=t.pop();if(r in e)return n.value=r,n.done=!1,n}return n.done=!0,n}},k.values=m,p.prototype={constructor:p,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=g,this.done=!1,this.delegate=null,this.tryEntries.forEach(d),!e)for(var t in this)"t"===t.charAt(0)&&v.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=g)},stop:function(){this.done=!0;var e=this.tryEntries[0],t=e.completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(e){function t(t,n){return a.type="throw",a.arg=e,r.next=t,!!n}if(this.done)throw e;for(var r=this,n=this.tryEntries.length-1;n>=0;--n){var i=this.tryEntries[n],a=i.completion;if("root"===i.tryLoc)return t("end");if(i.tryLoc<=this.prev){var o=v.call(i,"catchLoc"),s=v.call(i,"finallyLoc");if(o&&s){if(this.prev<i.catchLoc)return t(i.catchLoc,!0);if(this.prev<i.finallyLoc)return t(i.finallyLoc)}else if(o){if(this.prev<i.catchLoc)return t(i.catchLoc,!0)}else{if(!s)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return t(i.finallyLoc)}}}},abrupt:function(e,t){for(var r=this.tryEntries.length-1;r>=0;--r){var n=this.tryEntries[r];if(n.tryLoc<=this.prev&&v.call(n,"finallyLoc")&&this.prev<n.finallyLoc){var i=n;break}}i&&("break"===e||"continue"===e)&&i.tryLoc<=t&&t<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=e,a.arg=t,i?this.next=i.finallyLoc:this.complete(a),R},complete:function(e,t){if("throw"===e.type)throw e.arg;"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=e.arg,this.next="end"):"normal"===e.type&&t&&(this.next=t)},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),d(r),R}},"catch":function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var i=n.arg;d(r)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,r){return this.delegate={iterator:m(e),resultName:t,nextLoc:r},R}}}("object"==typeof r?r:"object"==typeof window?window:"object"==typeof self?self:this)}).call(this,e("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{_process:279}],282:[function(e,t,r){function n(e){if(e&&!l(e))throw new Error("Unknown encoding: "+e)}function i(e){return e.toString(this.encoding)}function a(e){this.charReceived=e.length%2,this.charLength=this.charReceived?2:0}function o(e){this.charReceived=e.length%3,this.charLength=this.charReceived?3:0}var s=e("buffer").Buffer,l=s.isEncoding||function(e){switch(e&&e.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}},u=r.StringDecoder=function(e){switch(this.encoding=(e||"utf8").toLowerCase().replace(/[-_]/,""),n(e),this.encoding){case"utf8":this.surrogateSize=3;break;case"ucs2":case"utf16le":this.surrogateSize=2,this.detectIncompleteChar=a;break;case"base64":this.surrogateSize=3,this.detectIncompleteChar=o;break;default:return void(this.write=i)}this.charBuffer=new s(6),this.charReceived=0,this.charLength=0};u.prototype.write=function(e){for(var t="";this.charLength;){var r=e.length>=this.charLength-this.charReceived?this.charLength-this.charReceived:e.length;if(e.copy(this.charBuffer,this.charReceived,0,r),this.charReceived+=r,this.charReceived<this.charLength)return"";e=e.slice(r,e.length),t=this.charBuffer.slice(0,this.charLength).toString(this.encoding);var n=t.charCodeAt(t.length-1);if(!(n>=55296&&56319>=n)){if(this.charReceived=this.charLength=0,0===e.length)return t;break}this.charLength+=this.surrogateSize,t=""}this.detectIncompleteChar(e);var i=e.length;this.charLength&&(e.copy(this.charBuffer,0,e.length-this.charReceived,i),i-=this.charReceived),t+=e.toString(this.encoding,0,i);var i=t.length-1,n=t.charCodeAt(i);if(n>=55296&&56319>=n){var a=this.surrogateSize;return this.charLength+=a,this.charReceived+=a,this.charBuffer.copy(this.charBuffer,a,0,a),e.copy(this.charBuffer,0,0,a),t.substring(0,i)}return t},u.prototype.detectIncompleteChar=function(e){for(var t=e.length>=3?3:e.length;t>0;t--){var r=e[e.length-t];if(1==t&&r>>5==6){this.charLength=2;break}if(2>=t&&r>>4==14){this.charLength=3;break}if(3>=t&&r>>3==30){this.charLength=4;break}}this.charReceived=t},u.prototype.end=function(e){var t="";if(e&&e.length&&(t=this.write(e)),this.charReceived){var r=this.charReceived,n=this.charBuffer,i=this.encoding;t+=n.slice(0,r).toString(i)}return t}},{buffer:41}],283:[function(e,t){"use stric";var r="\\/\\*",n="\\/\\*(?!\\*?\\!)",i="(.|[\\r\\n]|\\n)*?\\*\\/\\n?\\n?",a=/(^|[^\S\n])(?:\/\/)([\s\S]+?)$/gm,o=/(^|[^\S\n])(?:\/\/[^!])([\s\S]+?)$/gm,s=t.exports=function(e,t){return e?s.block(s.line(e,t),t):""};s.block=function(e,t){t=t||{};var a=new RegExp(r+i,"gm");return t.safe&&(a=new RegExp(n+i,"gm")),e?e.replace(a,""):""},s.line=function(e,t){t=t||{};var r=a;return t.safe&&(r=o),e?e.replace(r,""):""}},{}],284:[function(t,r){!function(){function t(e,t){function r(t){var r,n=e.arcs[0>t?~t:t],i=n[0];return e.transform?(r=[0,0],n.forEach(function(e){r[0]+=e[0],r[1]+=e[1]})):r=n[n.length-1],0>t?[r,i]:[i,r]}function n(e,t){for(var r in e){var n=e[r];delete t[n.start],delete n.start,delete n.end,n.forEach(function(e){i[0>e?~e:e]=1}),s.push(n)}}var i={},a={},o={},s=[],l=-1;return t.forEach(function(r,n){var i,a=e.arcs[0>r?~r:r];a.length<3&&!a[1][0]&&!a[1][1]&&(i=t[++l],t[l]=r,t[n]=i)}),t.forEach(function(e){var t,n,i=r(e),s=i[0],l=i[1];if(t=o[s])if(delete o[t.end],t.push(e),t.end=l,n=a[l]){delete a[n.start];var u=n===t?t:t.concat(n);a[u.start=t.start]=o[u.end=n.end]=u}else a[t.start]=o[t.end]=t;else if(t=a[l])if(delete a[t.start],t.unshift(e),t.start=s,n=o[s]){delete o[n.end];var c=n===t?t:n.concat(t);a[c.start=n.start]=o[c.end=t.end]=c}else a[t.start]=o[t.end]=t;else t=[e],a[t.start=s]=o[t.end=l]=t}),n(o,a),n(a,o),t.forEach(function(e){i[0>e?~e:e]||s.push([e])}),s}function i(e,r,n){function i(e){var t=0>e?~e:e;(c[t]||(c[t]=[])).push({i:e,g:u})}function a(e){e.forEach(i)}function o(e){e.forEach(a)}function s(e){"GeometryCollection"===e.type?e.geometries.forEach(s):e.type in f&&(u=e,f[e.type](e.arcs))}var l=[];if(arguments.length>1){var u,c=[],f={LineString:a,MultiLineString:o,Polygon:o,MultiPolygon:function(e){e.forEach(o)}};s(r),c.forEach(arguments.length<3?function(e){l.push(e[0].i)}:function(e){n(e[0].g,e[e.length-1].g)&&l.push(e[0].i)})}else for(var h=0,d=e.arcs.length;d>h;++h)l.push(h);return{type:"MultiLineString",arcs:t(e,l)}}function a(e,r){function i(e){e.forEach(function(t){t.forEach(function(t){(o[t=0>t?~t:t]||(o[t]=[])).push(e)})}),s.push(e)}function a(t){return d(l(e,{type:"Polygon",arcs:[t]}).coordinates[0])>0}var o={},s=[],u=[];return r.forEach(function(e){"Polygon"===e.type?i(e.arcs):"MultiPolygon"===e.type&&e.arcs.forEach(i)}),s.forEach(function(e){if(!e._){var t=[],r=[e];for(e._=1,u.push(t);e=r.pop();)t.push(e),e.forEach(function(e){e.forEach(function(e){o[0>e?~e:e].forEach(function(e){e._||(e._=1,r.push(e))})})})}}),s.forEach(function(e){delete e._}),{type:"MultiPolygon",arcs:u.map(function(r){var i=[];if(r.forEach(function(e){e.forEach(function(e){e.forEach(function(e){o[0>e?~e:e].length<2&&i.push(e)})})}),i=t(e,i),(n=i.length)>1)for(var s,l=a(r[0][0]),u=0;n>u;++u)if(l===a(i[u])){s=i[0],i[0]=i[u],i[u]=s;break}return i})}}function o(e,t){return"GeometryCollection"===t.type?{type:"FeatureCollection",features:t.geometries.map(function(t){return s(e,t)})}:s(e,t)}function s(e,t){var r={type:"Feature",id:t.id,properties:t.properties||{},geometry:l(e,t)};return null==t.id&&delete r.id,r}function l(e,t){function r(e,t){t.length&&t.pop();for(var r,n=c[0>e?~e:e],i=0,a=n.length;a>i;++i)t.push(r=n[i].slice()),l(r,i);0>e&&u(t,a)}function n(e){return e=e.slice(),l(e,0),e}function i(e){for(var t=[],n=0,i=e.length;i>n;++n)r(e[n],t);return t.length<2&&t.push(t[0].slice()),t}function a(e){for(var t=i(e);t.length<4;)t.push(t[0].slice());return t}function o(e){return e.map(a)}function s(e){var t=e.type;return"GeometryCollection"===t?{type:t,geometries:e.geometries.map(s)}:t in f?{type:t,coordinates:f[t](e)}:null}var l=g(e.transform),c=e.arcs,f={Point:function(e){return n(e.coordinates)},MultiPoint:function(e){return e.coordinates.map(n)},LineString:function(e){return i(e.arcs)},MultiLineString:function(e){return e.arcs.map(i)},Polygon:function(e){return o(e.arcs)},MultiPolygon:function(e){return e.arcs.map(o)}};return s(t)}function u(e,t){for(var r,n=e.length,i=n-t;i<--n;)r=e[i],e[i++]=e[n],e[n]=r}function c(e,t){for(var r=0,n=e.length;n>r;){var i=r+n>>>1;e[i]<t?r=i+1:n=i}return r}function f(e){function t(e,t){e.forEach(function(e){0>e&&(e=~e);var r=i[e];r?r.push(t):i[e]=[t]})}function r(e,r){e.forEach(function(e){t(e,r)})}function n(e,t){"GeometryCollection"===e.type?e.geometries.forEach(function(e){n(e,t)}):e.type in o&&o[e.type](e.arcs,t)}var i={},a=e.map(function(){return[]}),o={LineString:t,MultiLineString:r,Polygon:r,MultiPolygon:function(e,t){e.forEach(function(e){r(e,t)})}};e.forEach(n);for(var s in i)for(var l=i[s],u=l.length,f=0;u>f;++f)for(var h=f+1;u>h;++h){var d,p=l[f],m=l[h];(d=a[p])[s=c(d,m)]!==m&&d.splice(s,0,m),(d=a[m])[s=c(d,p)]!==p&&d.splice(s,0,p)}return a}function h(e,t){function r(e){a.remove(e),e[1][2]=t(e),a.push(e)}var n=g(e.transform),i=v(e.transform),a=_();return t||(t=p),e.arcs.forEach(function(e){for(var o,s,l=[],u=0,c=0,f=e.length;f>c;++c)s=e[c],n(e[c]=[s[0],s[1],1/0],c);for(var c=1,f=e.length-1;f>c;++c)o=e.slice(c-1,c+2),o[1][2]=t(o),l.push(o),a.push(o);for(var c=0,f=l.length;f>c;++c)o=l[c],o.previous=l[c-1],o.next=l[c+1];for(;o=a.pop();){var h=o.previous,d=o.next;o[1][2]<u?o[1][2]=u:u=o[1][2],h&&(h.next=d,h[2]=o[2],r(h)),d&&(d.previous=h,d[0]=o[0],r(d))}e.forEach(i)}),e}function d(e){for(var t,r=-1,n=e.length,i=e[n-1],a=0;++r<n;)t=i,i=e[r],a+=t[0]*i[1]-t[1]*i[0];return.5*a}function p(e){var t=e[0],r=e[1],n=e[2];return Math.abs((t[0]-n[0])*(r[1]-t[1])-(t[0]-r[0])*(n[1]-t[1]))}function m(e,t){return e[1][2]-t[1][2]}function _(){function e(e,t){for(;t>0;){var r=(t+1>>1)-1,i=n[r];if(m(e,i)>=0)break;n[i._=t]=i,n[e._=t=r]=e}}function t(e,t){for(;;){var r=t+1<<1,a=r-1,o=t,s=n[o];if(i>a&&m(n[a],s)<0&&(s=n[o=a]),i>r&&m(n[r],s)<0&&(s=n[o=r]),o===t)break;n[s._=t]=s,n[e._=t=o]=e}}var r={},n=[],i=0;return r.push=function(t){return e(n[t._=i]=t,i++),i},r.pop=function(){if(!(0>=i)){var e,r=n[0];return--i>0&&(e=n[i],t(n[e._=0]=e,0)),r}},r.remove=function(r){var a,o=r._;if(n[o]===r)return o!==--i&&(a=n[i],(m(a,r)<0?e:t)(n[a._=o]=a,o)),o},r}function g(e){if(!e)return y;var t,r,n=e.scale[0],i=e.scale[1],a=e.translate[0],o=e.translate[1];return function(e,s){s||(t=r=0),e[0]=(t+=e[0])*n+a,e[1]=(r+=e[1])*i+o}}function v(e){if(!e)return y;var t,r,n=e.scale[0],i=e.scale[1],a=e.translate[0],o=e.translate[1];return function(e,s){s||(t=r=0);var l=(e[0]-a)/n|0,u=(e[1]-o)/i|0;e[0]=l-t,e[1]=u-r,t=l,r=u}}function y(){}var b={version:"1.6.19",mesh:function(e){return l(e,i.apply(this,arguments))},meshArcs:i,merge:function(e){return l(e,a.apply(this,arguments))},mergeArcs:a,feature:o,neighbors:f,presimplify:h};"function"==typeof e&&e.amd?e(b):"object"==typeof r&&r.exports?r.exports=b:this.topojson=b}()},{}],285:[function(e,t,r){(function(t,n){"use strict";function i(e){if(e){var t=e.length||e.byteLength,r=v.log2(t);w[r].push(e)}}function a(e){i(e.buffer)}function o(e){var e=v.nextPow2(e),t=v.log2(e),r=w[t];return r.length>0?r.pop():new ArrayBuffer(e)}function s(e){return new Uint8Array(o(e),0,e)}function l(e){return new Uint16Array(o(2*e),0,e)}function u(e){return new Uint32Array(o(4*e),0,e)}function c(e){return new Int8Array(o(e),0,e)}function f(e){return new Int16Array(o(2*e),0,e)}function h(e){return new Int32Array(o(4*e),0,e)}function d(e){return new Float32Array(o(4*e),0,e)}function p(e){return new Float64Array(o(8*e),0,e)}function m(e){return b?new Uint8ClampedArray(o(e),0,e):s(e)}function _(e){return new DataView(o(e),0,e)}function g(e){e=v.nextPow2(e);var t=v.log2(e),r=k[t];return r.length>0?r.pop():new n(e)}var v=e("bit-twiddle"),y=e("dup");t.__TYPEDARRAY_POOL||(t.__TYPEDARRAY_POOL={UINT8:y([32,0]),UINT16:y([32,0]),UINT32:y([32,0]),INT8:y([32,0]),INT16:y([32,0]),INT32:y([32,0]),FLOAT:y([32,0]),DOUBLE:y([32,0]),DATA:y([32,0]),UINT8C:y([32,0]),BUFFER:y([32,0])});var b="undefined"!=typeof Uint8ClampedArray,x=t.__TYPEDARRAY_POOL;x.UINT8C||(x.UINT8C=y([32,0])),x.BUFFER||(x.BUFFER=y([32,0]));var w=x.DATA,k=x.BUFFER;r.free=function(e){if(n.isBuffer(e))k[v.log2(e.length)].push(e);else{if("[object ArrayBuffer]"!==Object.prototype.toString.call(e)&&(e=e.buffer),!e)return;var t=e.length||e.byteLength,r=0|v.log2(t);w[r].push(e)}},r.freeUint8=r.freeUint16=r.freeUint32=r.freeInt8=r.freeInt16=r.freeInt32=r.freeFloat32=r.freeFloat=r.freeFloat64=r.freeDouble=r.freeUint8Clamped=r.freeDataView=a,r.freeArrayBuffer=i,r.freeBuffer=function(e){k[v.log2(e.length)].push(e) 10 },r.malloc=function(e,t){if(void 0===t||"arraybuffer"===t)return o(e);switch(t){case"uint8":return s(e);case"uint16":return l(e);case"uint32":return u(e);case"int8":return c(e);case"int16":return f(e);case"int32":return h(e);case"float":case"float32":return d(e);case"double":case"float64":return p(e);case"uint8_clamped":return m(e);case"buffer":return g(e);case"data":case"dataview":return _(e);default:return null}return null},r.mallocArrayBuffer=o,r.mallocUint8=s,r.mallocUint16=l,r.mallocUint32=u,r.mallocInt8=c,r.mallocInt16=f,r.mallocInt32=h,r.mallocFloat32=r.mallocFloat=d,r.mallocFloat64=r.mallocDouble=p,r.mallocUint8Clamped=m,r.mallocDataView=_,r.mallocBuffer=g,r.clearCache=function(){for(var e=0;32>e;++e)x.UINT8[e].length=0,x.UINT16[e].length=0,x.UINT32[e].length=0,x.INT8[e].length=0,x.INT16[e].length=0,x.INT32[e].length=0,x.FLOAT[e].length=0,x.DOUBLE[e].length=0,x.UINT8C[e].length=0,w[e].length=0,k[e].length=0}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},e("buffer").Buffer)},{"bit-twiddle":32,buffer:41,dup:166}],286:[function(e,t){(function(e){function r(e,t){function r(){if(!i){if(n("throwDeprecation"))throw new Error(t);n("traceDeprecation")?console.trace(t):console.warn(t),i=!0}return e.apply(this,arguments)}if(n("noDeprecation"))return e;var i=!1;return r}function n(t){try{if(!e.localStorage)return!1}catch(r){return!1}var n=e.localStorage[t];return null==n?!1:"true"===String(n).toLowerCase()}t.exports=r}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],287:[function(e,t,r){arguments[4][187][0].apply(r,arguments)},{dup:187}],288:[function(e,t){t.exports=function(e){return e&&"object"==typeof e&&"function"==typeof e.copy&&"function"==typeof e.fill&&"function"==typeof e.readUInt8}},{}],289:[function(e,t,r){(function(t,n){function i(e,t){var n={seen:[],stylize:o};return arguments.length>=3&&(n.depth=arguments[2]),arguments.length>=4&&(n.colors=arguments[3]),m(t)?n.showHidden=t:t&&r._extend(n,t),x(n.showHidden)&&(n.showHidden=!1),x(n.depth)&&(n.depth=2),x(n.colors)&&(n.colors=!1),x(n.customInspect)&&(n.customInspect=!0),n.colors&&(n.stylize=a),l(n,e,n.depth)}function a(e,t){var r=i.styles[t];return r?"["+i.colors[r][0]+"m"+e+"["+i.colors[r][1]+"m":e}function o(e){return e}function s(e){var t={};return e.forEach(function(e){t[e]=!0}),t}function l(e,t,n){if(e.customInspect&&t&&E(t.inspect)&&t.inspect!==r.inspect&&(!t.constructor||t.constructor.prototype!==t)){var i=t.inspect(n,e);return y(i)||(i=l(e,i,n)),i}var a=u(e,t);if(a)return a;var o=Object.keys(t),m=s(o);if(e.showHidden&&(o=Object.getOwnPropertyNames(t)),T(t)&&(o.indexOf("message")>=0||o.indexOf("description")>=0))return c(t);if(0===o.length){if(E(t)){var _=t.name?": "+t.name:"";return e.stylize("[Function"+_+"]","special")}if(w(t))return e.stylize(RegExp.prototype.toString.call(t),"regexp");if(A(t))return e.stylize(Date.prototype.toString.call(t),"date");if(T(t))return c(t)}var g="",v=!1,b=["{","}"];if(p(t)&&(v=!0,b=["[","]"]),E(t)){var x=t.name?": "+t.name:"";g=" [Function"+x+"]"}if(w(t)&&(g=" "+RegExp.prototype.toString.call(t)),A(t)&&(g=" "+Date.prototype.toUTCString.call(t)),T(t)&&(g=" "+c(t)),0===o.length&&(!v||0==t.length))return b[0]+g+b[1];if(0>n)return w(t)?e.stylize(RegExp.prototype.toString.call(t),"regexp"):e.stylize("[Object]","special");e.seen.push(t);var k;return k=v?f(e,t,n,m,o):o.map(function(r){return h(e,t,n,m,r,v)}),e.seen.pop(),d(k,g,b)}function u(e,t){if(x(t))return e.stylize("undefined","undefined");if(y(t)){var r="'"+JSON.stringify(t).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return e.stylize(r,"string")}return v(t)?e.stylize(""+t,"number"):m(t)?e.stylize(""+t,"boolean"):_(t)?e.stylize("null","null"):void 0}function c(e){return"["+Error.prototype.toString.call(e)+"]"}function f(e,t,r,n,i){for(var a=[],o=0,s=t.length;s>o;++o)a.push(z(t,String(o))?h(e,t,r,n,String(o),!0):"");return i.forEach(function(i){i.match(/^\d+$/)||a.push(h(e,t,r,n,i,!0))}),a}function h(e,t,r,n,i,a){var o,s,u;if(u=Object.getOwnPropertyDescriptor(t,i)||{value:t[i]},u.get?s=u.set?e.stylize("[Getter/Setter]","special"):e.stylize("[Getter]","special"):u.set&&(s=e.stylize("[Setter]","special")),z(n,i)||(o="["+i+"]"),s||(e.seen.indexOf(u.value)<0?(s=_(r)?l(e,u.value,null):l(e,u.value,r-1),s.indexOf("\n")>-1&&(s=a?s.split("\n").map(function(e){return" "+e}).join("\n").substr(2):"\n"+s.split("\n").map(function(e){return" "+e}).join("\n"))):s=e.stylize("[Circular]","special")),x(o)){if(a&&i.match(/^\d+$/))return s;o=JSON.stringify(""+i),o.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(o=o.substr(1,o.length-2),o=e.stylize(o,"name")):(o=o.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),o=e.stylize(o,"string"))}return o+": "+s}function d(e,t,r){var n=0,i=e.reduce(function(e,t){return n++,t.indexOf("\n")>=0&&n++,e+t.replace(/\u001b\[\d\d?m/g,"").length+1},0);return i>60?r[0]+(""===t?"":t+"\n ")+" "+e.join(",\n ")+" "+r[1]:r[0]+t+" "+e.join(", ")+" "+r[1]}function p(e){return Array.isArray(e)}function m(e){return"boolean"==typeof e}function _(e){return null===e}function g(e){return null==e}function v(e){return"number"==typeof e}function y(e){return"string"==typeof e}function b(e){return"symbol"==typeof e}function x(e){return void 0===e}function w(e){return k(e)&&"[object RegExp]"===R(e)}function k(e){return"object"==typeof e&&null!==e}function A(e){return k(e)&&"[object Date]"===R(e)}function T(e){return k(e)&&("[object Error]"===R(e)||e instanceof Error)}function E(e){return"function"==typeof e}function S(e){return null===e||"boolean"==typeof e||"number"==typeof e||"string"==typeof e||"symbol"==typeof e||"undefined"==typeof e}function R(e){return Object.prototype.toString.call(e)}function j(e){return 10>e?"0"+e.toString(10):e.toString(10)}function M(){var e=new Date,t=[j(e.getHours()),j(e.getMinutes()),j(e.getSeconds())].join(":");return[e.getDate(),L[e.getMonth()],t].join(" ")}function z(e,t){return Object.prototype.hasOwnProperty.call(e,t)}var C=/%[sdj%]/g;r.format=function(e){if(!y(e)){for(var t=[],r=0;r<arguments.length;r++)t.push(i(arguments[r]));return t.join(" ")}for(var r=1,n=arguments,a=n.length,o=String(e).replace(C,function(e){if("%%"===e)return"%";if(r>=a)return e;switch(e){case"%s":return String(n[r++]);case"%d":return Number(n[r++]);case"%j":try{return JSON.stringify(n[r++])}catch(t){return"[Circular]"}default:return e}}),s=n[r];a>r;s=n[++r])o+=_(s)||!k(s)?" "+s:" "+i(s);return o},r.deprecate=function(e,i){function a(){if(!o){if(t.throwDeprecation)throw new Error(i);t.traceDeprecation?console.trace(i):console.error(i),o=!0}return e.apply(this,arguments)}if(x(n.process))return function(){return r.deprecate(e,i).apply(this,arguments)};if(t.noDeprecation===!0)return e;var o=!1;return a};var P,N={};r.debuglog=function(e){if(x(P)&&(P=t.env.NODE_DEBUG||""),e=e.toUpperCase(),!N[e])if(new RegExp("\\b"+e+"\\b","i").test(P)){var n=t.pid;N[e]=function(){var t=r.format.apply(r,arguments);console.error("%s %d: %s",e,n,t)}}else N[e]=function(){};return N[e]},r.inspect=i,i.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},i.styles={special:"cyan",number:"yellow","boolean":"yellow",undefined:"grey","null":"bold",string:"green",date:"magenta",regexp:"red"},r.isArray=p,r.isBoolean=m,r.isNull=_,r.isNullOrUndefined=g,r.isNumber=v,r.isString=y,r.isSymbol=b,r.isUndefined=x,r.isRegExp=w,r.isObject=k,r.isDate=A,r.isError=T,r.isFunction=E,r.isPrimitive=S,r.isBuffer=e("./support/isBuffer");var L=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];r.log=function(){console.log("%s - %s",M(),r.format.apply(r,arguments))},r.inherits=e("inherits"),r._extend=function(e,t){if(!t||!k(t))return e;for(var r=Object.keys(t),n=r.length;n--;)e[r[n]]=t[r[n]];return e}}).call(this,e("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./support/isBuffer":288,_process:279,inherits:287}],290:[function(e,t){t.exports.VectorTile=e("./lib/vectortile.js"),t.exports.VectorTileFeature=e("./lib/vectortilefeature.js"),t.exports.VectorTileLayer=e("./lib/vectortilelayer.js")},{"./lib/vectortile.js":291,"./lib/vectortilefeature.js":292,"./lib/vectortilelayer.js":293}],291:[function(e,t){"use strict";function r(e,t){this.layers=e.readFields(n,{},t)}function n(e,t,r){if(3===e){var n=new i(r,r.readVarint()+r.pos);n.length&&(t[n.name]=n)}}var i=e("./vectortilelayer");t.exports=r},{"./vectortilelayer":293}],292:[function(e,t){"use strict";function r(e,t,r,i,a){this.properties={},this.extent=r,this.type=0,this._pbf=e,this._geometry=-1,this._keys=i,this._values=a,e.readFields(n,this,t)}function n(e,t,r){1==e?t._id=r.readVarint():2==e?i(r,t):3==e?t.type=r.readVarint():4==e&&(t._geometry=r.pos)}function i(e,t){for(var r=e.readVarint()+e.pos;e.pos<r;){var n=t._keys[e.readVarint()],i=t._values[e.readVarint()];t.properties[n]=i}}var a=e("point-geometry");t.exports=r,r.types=["Unknown","Point","LineString","Polygon"],r.prototype.loadGeometry=function(){var e=this._pbf;e.pos=this._geometry;for(var t,r=e.readVarint()+e.pos,n=1,i=0,o=0,s=0,l=[];e.pos<r;){if(!i){var u=e.readVarint();n=7&u,i=u>>3}if(i--,1===n||2===n)o+=e.readSVarint(),s+=e.readSVarint(),1===n&&(t&&l.push(t),t=[]),t.push(new a(o,s));else{if(7!==n)throw new Error("unknown command "+n);t.push(t[0].clone())}}return t&&l.push(t),l},r.prototype.bbox=function(){var e=this._pbf;e.pos=this._geometry;for(var t=e.readVarint()+e.pos,r=1,n=0,i=0,a=0,o=1/0,s=-1/0,l=1/0,u=-1/0;e.pos<t;){if(!n){var c=e.readVarint();r=7&c,n=c>>3}if(n--,1===r||2===r)i+=e.readSVarint(),a+=e.readSVarint(),o>i&&(o=i),i>s&&(s=i),l>a&&(l=a),a>u&&(u=a);else if(7!==r)throw new Error("unknown command "+r)}return[o,l,s,u]},r.prototype.toGeoJSON=function(e,t,n){for(var i=this.extent*Math.pow(2,n),a=this.extent*e,o=this.extent*t,s=this.loadGeometry(),l=r.types[this.type],u=0;u<s.length;u++)for(var c=s[u],f=0;f<c.length;f++){var h=c[f],d=180-360*(h.y+o)/i;c[f]=[360*(h.x+a)/i-180,360/Math.PI*Math.atan(Math.exp(d*Math.PI/180))-90]}return"Point"===l&&1===s.length?s=s[0][0]:"Point"===l?(s=s[0],l="MultiPoint"):"LineString"===l&&1===s.length?s=s[0]:"LineString"===l&&(l="MultiLineString"),{type:"Feature",geometry:{type:l,coordinates:s},properties:this.properties}}},{"point-geometry":277}],293:[function(e,t){"use strict";function r(e,t){this.version=1,this.name=null,this.extent=4096,this.length=0,this._pbf=e,this._keys=[],this._values=[],this._features=[],e.readFields(n,this,t),this.length=this._features.length}function n(e,t,r){15===e?t.version=r.readVarint():1===e?t.name=r.readString():5===e?t.extent=r.readVarint():2===e?t._features.push(r.pos):3===e?t._keys.push(r.readString()):4===e&&t._values.push(i(r))}function i(e){for(var t=null,r=e.readVarint()+e.pos;e.pos<r;){var n=e.readVarint()>>3;t=1===n?e.readString():2===n?e.readFloat():3===n?e.readDouble():4===n?e.readVarint64():5===n?e.readVarint():6===n?e.readSVarint():7===n?e.readBoolean():null}return t}var a=e("./vectortilefeature.js");t.exports=r,r.prototype.feature=function(e){if(0>e||e>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[e];var t=this._pbf.readVarint()+this._pbf.pos;return new a(this._pbf,t,this.extent,this._keys,this._values)}},{"./vectortilefeature.js":292}],294:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function i(e,t,r){var n=l[0],i=l[1];return e[0]<=n.x+r&&t[0]<=n.x+r||e[0]>=i.x-r&&t[0]>=i.x-r||e[1]>=n.y-r&&t[1]>=n.y-r||e[1]<=i.y+r&&t[1]<=i.y+r?!0:!1}function a(e,t){t=t||0;var r=l[0],n=l[1];return e[0]<=r.x+t||e[0]>=n.x-t||e[1]>=r.y-t||e[1]<=n.y+t}Object.defineProperty(r,"__esModule",{value:!0}),r.default_uvs=r.tile_bounds=void 0,r.outsideTile=i,r.isCoordOutsideTile=a;{var o=e("../geo"),s=n(o),l=r.tile_bounds=[{x:0,y:0},{x:s.default.tile_scale,y:-s.default.tile_scale}];r.default_uvs=[0,0,1,1]}},{"../geo":299}],295:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function i(e,t,r,n,i){var a=n.texcoord_index,l=n.position_index,u=n.shape_index,c=n.offset_index,f=i.quad,h=i.quad_normalize,d=i.offset,p=i.angle,m=i.shape_w,_=i.texcoord_scale,g=i.texcoord_normalize;h=h||1;var v=f[0]/2*h,y=f[1]/2*h,b=[[-v,-y],[v,-y],[v,y],[-v,y]],x=t.vertex_elements,w=t.vertex_count,k=void 0;if(a){g=g||1;var A=_||s.default_uvs,T=o.default(A,4),E=T[0],S=T[1],R=T[2],j=T[3];k=[[E,S],[R,S],[R,j],[E,j]]}for(var M=e.length,z=0;M>z;z++){for(var C=e[z],P=0;4>P;P++)a&&(r[a+0]=k[P][0]*g,r[a+1]=k[P][1]*g),r[l+0]=C[0],r[l+1]=C[1],r[u+0]=b[P][0],r[u+1]=b[P][1],r[u+2]=p,r[u+3]=m,r[c+0]=d[0],r[c+1]=d[1],t.addVertex(r);x.push(w+0),x.push(w+1),x.push(w+2),x.push(w+2),x.push(w+3),x.push(w+0),w+=4}}Object.defineProperty(r,"__esModule",{value:!0});var a=e("babel-runtime/helpers/slicedToArray"),o=n(a);r.buildQuadsForPoints=i;var s=e("./common")},{"./common":294,"babel-runtime/helpers/slicedToArray":27}],296:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function i(e,t,r,n){var i=n.texcoord_index,a=n.texcoord_scale,s=n.texcoord_normalize,u=t.vertex_elements;if(i){s=s||1;var f=a||d.default_uvs,h=l.default(f,4),p=h[0],_=h[1],g=h[2],v=h[3]}for(var y=e.length,b=0;y>b;b++){var x=t.vertex_count,w=e[b];if(i)var k=c.default.findBoundingBox(w),A=l.default(k,4),T=A[0],E=A[1],S=A[2],R=A[3],j=S-T,M=R-E,z=(g-p)/j,C=(v-_)/M;for(var P=0;P<w.length;P++)for(var N=w[P],L=0;L<N.length;L++){var O=N[L];r[0]=O[0],r[1]=O[1],i&&(r[i+0]=((O[0]-T)*z+p)*s,r[i+1]=((O[1]-E)*C+_)*s),t.addVertex(r)}for(var I=o(m.default.flatten(w)),F=0;F<I.length;F++)u.push(x+I[F])}}function a(e,t,r,n,a,o,s,u,c){var f=c.remove_tile_edges,p=c.tile_edge_tolerance,m=c.texcoord_index,g=c.texcoord_scale,v=c.texcoord_normalize,y=c.winding,b=t+(n||0),x=t+r;o[2]=x,i(e,a,o,{texcoord_index:m,texcoord_scale:g,texcoord_normalize:v});var w=a.vertex_elements,k=a.vertex_count;if(m){v=v||1;var A=g||d.default_uvs,T=l.default(A,4),E=T[0],S=T[1],R=T[2],j=T[3],M=[[E,j],[E,S],[R,S],[R,j]]}for(var z=e.length,C=0;z>C;C++)for(var P=e[C],N=0;N<P.length;N++)for(var L=P[N],O=0;O<L.length-1;O++)if(!f||!d.outsideTile(L[O],L[O+1],p)){var I=void 0,F=void 0;"CCW"===y?(I=O,F=O+1):(I=O+1,F=O);var U=[[L[F][0],L[F][1],x],[L[F][0],L[F][1],b],[L[I][0],L[I][1],b],[L[I][0],L[I][1],x]],D=h.default.normalize([L[F][0]-L[I][0],L[F][1]-L[I][1],0]),B=h.default.cross(_,D);o[s+0]=B[0]*u,o[s+1]=B[1]*u,o[s+2]=B[2]*u;for(var G=0;G<U.length;G++)o[0]=U[G][0],o[1]=U[G][1],o[2]=U[G][2],m&&(o[m+0]=M[G][0]*v,o[m+1]=M[G][1]*v),a.addVertex(o);w.push(k+0),w.push(k+1),w.push(k+2),w.push(k+2),w.push(k+3),w.push(k+0),k+=4}}function o(e){return m.default(e.vertices,e.holes,e.dimensions)}Object.defineProperty(r,"__esModule",{value:!0});var s=e("babel-runtime/helpers/slicedToArray"),l=n(s);r.buildPolygons=i,r.buildExtrudedPolygons=a,r.triangulatePolygon=o;var u=e("../geo"),c=n(u),f=e("../vector"),h=n(f),d=e("./common"),p=e("earcut"),m=n(p),_=[0,0,1]},{"../geo":299,"../vector":361,"./common":294,"babel-runtime/helpers/slicedToArray":27,earcut:167}],297:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function i(e,t,r,n,i){var o=i.closed_polygon,s=i.remove_tile_edges,l=i.tile_edge_tolerance,u=i.texcoord_index,c=(i.texcoord_scale,i.texcoord_width),f=i.texcoord_ratio,h=i.texcoord_normalize,d=i.scaling_index,p=i.scaling_normalize,m=i.join,_=i.cap,g=i.miter_limit,v=_?j[_]:j.butt,y=m?M[m]:M.miter;if(y===M.miter){g=g||z.MITER_LIMIT;var b=g*g}var x;u&&(h=h||z.TEXCOORD_NORMALIZE,f=f||z.TEXCOORD_RATIO,x=1/(c*f*C));for(var w={closed_polygon:o,remove_tile_edges:s,tile_edge_tolerance:l,miter_len_sq:b,join_type:y,cap_type:v,vertex_data:r,vertex_template:n,half_width:t/2,scaling_index:d,scaling_normalize:p,v_scale:x,texcoord_index:u,texcoord_width:c,texcoord_normalize:h},k=[],A=0;A<e.length;A++)a(e[A],w,k);for(var T=0;T<k.length;T++)a(k[T],w,k)}function a(e,t,r){if(!(e.length<2)){var n,i,a,c,m=t.join_type,_=t.cap_type,g=t.closed_polygon,y=t.remove_tile_edges,x=t.tile_edge_tolerance,w=t.v_scale,k=t.miter_len_sq,T=0;if(g&&m===M.miter){var E=o(e);if(0!==E){var R=b(e,E);return void r.push(R)}}if(n=e[0],i=e[1],A.default.isEqual(n,i))return void(e.length>2&&r.push(e.slice(1)));if(c=A.default.normalize(A.default.perp(n,i)),y&&S.outsideTile(n,i,x)){var z=s(e,0,x);return void(z&&r.push(z))}g?(a=A.default.normalize(A.default.perp(e[e.length-2],n)),l(n,a,c,m,t)):(S.isCoordOutsideTile(n)||(v(n,T,c,_,!0,t),_!==j.butt&&(T+=.5*w*t.texcoord_width)),p(n,c,[1,T],t),p(n,A.default.neg(c),[0,T],t)),T+=w*A.default.length(A.default.sub(i,n));for(var C=1;C<e.length-1;C++){var P=C,N=C+1;if(n=e[P],i=e[N],!A.default.isEqual(n,i)){if(y&&S.outsideTile(n,i,x)){p(n,c,[1,T],t),p(n,A.default.neg(c),[0,T],t),d(1,t);var L=s(e,P+1,x);return void(L&&r.push(L))}a=c,c=A.default.normalize(A.default.perp(n,i)),m===M.miter?f(T,n,a,c,k,!1,t):h(m,T,n,a,c,!1,t),T+=w*A.default.length(A.default.sub(i,n))}}n=i,a=c,g?(c=A.default.normalize(A.default.perp(n,e[1])),u(n,a,c,m,T,t)):(p(n,a,[1,T],t),p(n,A.default.neg(a),[0,T],t),d(1,t),S.isCoordOutsideTile(n)||v(n,T,a,_,!1,t))}}function o(e){if(S.isCoordOutsideTile(e[0]))return 0;for(var t=0;t<e.length;t++){var r=e[e.length-1-t];if(S.isCoordOutsideTile(r))return e.length-1-t}return 0}function s(e,t,r){for(var n=t;e[n+1]&&S.outsideTile(e[n],e[n+1],r);)n++;return e.length-n>=2?e.slice(n):!1}function l(e,t,r,n,i){if(void 0===n||S.isCoordOutsideTile(e))p(e,r,[1,0],i),p(e,A.default.neg(r),[0,0],i);else{var a=0;n===M.miter?f(a,e,t,r,i.miter_len_sq,!0,i):h(n,a,e,t,r,!0,i)}}function u(e,t,r,n,i,a){if(S.isCoordOutsideTile(e))p(e,t,[1,i],a),p(e,A.default.neg(t),[0,i],a),d(1,a);else{var o=c(t,r);n===M.miter&&A.default.lengthSq(o)>a.miter_len_sq&&(n=M.bevel),n===M.miter?(p(e,o,[1,i],a),p(e,A.default.neg(o),[0,i],a),d(1,a)):(p(e,t,[1,i],a),p(e,A.default.neg(t),[0,i],a),d(1,a))}}function c(e,t){var r=A.default.normalize(A.default.add(e,t)),n=2/(1+Math.abs(A.default.dot(e,r)));return A.default.mult(r,n*n)}function f(e,t,r,n,i,a,o){var s=c(r,n);A.default.lengthSq(s)>i?h(M.miter,e,t,r,n,a,o):(p(t,s,[1,e],o),p(t,A.default.neg(s),[0,e],o),a||d(1,o))}function h(e,t,r,n,i,a,o){var s=c(n,i),l=i[0]*n[1]-i[1]*n[0]>0;l?(p(r,s,[1,t],o),p(r,A.default.neg(n),[0,t],o),a||d(1,o),e===M.bevel?g(r,A.default.neg(n),s,A.default.neg(i),[0,t],[1,t],[0,t],o):e===M.round&&_(r,A.default.neg(n),s,A.default.neg(i),[0,t],[1,t],[0,t],!1,o),p(r,s,[1,t],o),p(r,A.default.neg(i),[0,t],o)):(p(r,n,[1,t],o),p(r,A.default.neg(s),[0,t],o),a||d(1,o),e===M.bevel?g(r,n,A.default.neg(s),i,[1,t],[0,t],[1,t],o):e===M.round&&_(r,n,A.default.neg(s),i,[1,t],[0,t],[1,t],!1,o),p(r,i,[1,t],o),p(r,A.default.neg(s),[0,t],o))}function d(e,t){for(var r=t.vertex_data.vertex_elements,n=t.vertex_data.vertex_count,i=n-2*e-2,a=0;e>a;a++)r.push(i+2*a+2),r.push(i+2*a+1),r.push(i+2*a+0),r.push(i+2*a+2),r.push(i+2*a+3),r.push(i+2*a+1)}function p(e,t,r,n){var i=n.vertex_template,a=n.vertex_data;m(i,e,r,t,n),a.addVertex(i)}function m(e,t,r,n,i){e[0]=t[0],e[1]=t[1],i.texcoord_index&&r&&(e[i.texcoord_index+0]=r[0]*i.texcoord_normalize,e[i.texcoord_index+1]=r[1]*i.texcoord_normalize),i.scaling_index&&(e[i.scaling_index+0]=n[0]*i.scaling_normalize,e[i.scaling_index+1]=n[1]*i.scaling_normalize,e[i.scaling_index+2]=i.half_width)}function _(e,t,r,n,i,a,o,s,l){for(var u=t[0]*n[1]-t[1]*n[0],c=A.default.dot(t,n),f=Math.atan2(u,c);f>=Math.PI;)f-=2*Math.PI;var h=y(f,l.half_width);if(!(1>h)){var d=l.vertex_data.vertex_count,m=l.vertex_data.vertex_elements;p(e,r,a,l),p(e,t,i,l);var _=t;if(void 0!==l.texcoord_index){var g;if(s){g=[];var v=A.default.sub(i,a)}else{g=A.default.set(i);var b=A.default.div(A.default.sub(o,i),h)}}for(var x=f/h,w=0;h>w;w++)_=A.default.rot(_,x),void 0!==l.texcoord_index&&(s?(v=A.default.rot(v,x),g[0]=v[0]+a[0],g[1]=v[1]*l.texcoord_width*l.v_scale+a[1]):g=A.default.add(g,b)),p(e,_,g,l),m.push(d+w+(u>0?2:1)),m.push(d),m.push(d+w+(u>0?1:2))}}function g(e,t,r,n,i,a,o,s){var l=s.vertex_data.vertex_count;p(e,r,a,s),p(e,t,i,s),p(e,n,o,s);var u=t[0]*n[1]-t[1]*n[0]>0,c=s.vertex_data.vertex_elements;u?(c.push(l+2),c.push(l+0),c.push(l+1)):(c.push(l+1),c.push(l+0),c.push(l+2))}function v(e,t,r,n,i,a){var o=A.default.neg(r);switch(n){case j.square:var s;i?(s=[r[1],-r[0]],p(e,A.default.add(r,s),[1,t],a),p(e,A.default.add(o,s),[0,t],a),t+=.5*a.texcoord_width*a.v_scale,p(e,r,[1,t],a),p(e,o,[0,t],a)):(s=[-r[1],r[0]],p(e,r,[1,t],a),p(e,o,[0,t],a),t+=.5*a.texcoord_width*a.v_scale,p(e,A.default.add(r,s),[1,t],a),p(e,A.default.add(o,s),[0,t],a)),d(1,a);break;case j.round:var l,u,c,f,h;i?(l=r,u=o,void 0!==a.texcoord_index&&(t+=.5*a.texcoord_width*a.v_scale,c=[1,t],f=[0,t],h=[.5,t])):(l=o,u=r,void 0!==a.texcoord_index&&(c=[0,t],f=[1,t],h=[.5,t])),_(e,l,R,u,c,h,f,!0,a);break;case j.butt:return}}function y(e,t){0>e&&(e=-e);var r=t>2*z.MIN_FAN_WIDTH?w.default(t/z.MIN_FAN_WIDTH):1;return Math.ceil(e/Math.PI*r)}function b(e,t){for(var r=[],n=0;n<e.length;n++){var i=(n+t)%e.length;0!==i&&r.push(e[i])}return r.push(r[0]),r}Object.defineProperty(r,"__esModule",{value:!0});var x=e("babel-runtime/core-js/math/log2"),w=n(x);r.buildPolylines=i;var k=e("../vector"),A=n(k),T=e("../geo"),E=n(T),S=e("./common"),R=[0,0],j={butt:0,square:1,round:2},M={miter:0,bevel:1,round:2},z={MITER_LIMIT:3,TEXCOORD_NORMALIZE:1,TEXCOORD_RATIO:1,MIN_FAN_WIDTH:5},C=E.default.tile_scale},{"../geo":299,"../vector":361,"./common":294,"babel-runtime/core-js/math/log2":8}],298:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(r,"__esModule",{value:!0});var i=e("babel-runtime/core-js/object/get-prototype-of"),a=n(i),o=e("babel-runtime/helpers/possibleConstructorReturn"),s=n(o),l=e("babel-runtime/helpers/get"),u=n(l),c=e("babel-runtime/helpers/inherits"),f=n(c),h=e("babel-runtime/helpers/classCallCheck"),d=n(h),p=e("babel-runtime/helpers/createClass"),m=n(p),_=e("./utils/utils"),g=n(_),v=e("./gl/shader_program"),y=n(v),b=e("./utils/gl-matrix"),x=function(){function e(t,r){var n=arguments.length<=2||void 0===arguments[2]?{}:arguments[2];d.default(this,e),this.view=r,this.position=n.position,this.zoom=n.zoom}return m.default(e,[{key:"update",value:function(){}},{key:"setupProgram",value:function(){}},{key:"updateView",value:function(){if(this.position||this.zoom){var e={};this.position&&(e={lng:this.position[0],lat:this.position[1],zoom:this.position[2]}),this.zoom&&(e.zoom=this.zoom),this.view.setView(e)}}},{key:"setupMatrices",value:function(e,t){b.mat4.multiply(e.model_view32,this.view_matrix,e.model),t.uniform("Matrix4fv","u_modelView",e.model_view32),b.mat3.normalFromMat4(e.normal32,e.model_view32),b.mat3.invert(e.inverse_normal32,e.normal32),t.uniform("Matrix3fv","u_normalMatrix",e.normal32),t.uniform("Matrix3fv","u_inverseNormalMatrix",e.inverse_normal32)}}],[{key:"create",value:function(e,t,r){switch(r.type){case"isometric":return new k(e,t,r);case"flat":return new A(e,t,r);case"perspective":default:return new w(e,t,r)}}}]),e}();r.default=x;var w=function(e){function t(e,r){var n=arguments.length<=2||void 0===arguments[2]?{}:arguments[2];d.default(this,t);var i=s.default(this,a.default(t).call(this,e,r,n));return i.type="perspective",i.focal_length=n.focal_length,i.fov=n.fov,i.focal_length||i.fov||(i.focal_length=[[16,2],[17,2.5],[18,3],[19,4],[20,6]]),i.vanishing_point=n.vanishing_point||[0,0],i.vanishing_point=i.vanishing_point.map(parseFloat),i.vanishing_point_skew=[],i.position_meters=null,i.view_matrix=new Float64Array(16),i.projection_matrix=new Float32Array(16),y.default.replaceBlock("camera","\n uniform mat4 u_projection;\n uniform vec3 u_eye;\n uniform vec2 u_vanishing_point;\n\n void cameraProjection (inout vec4 position) {\n position = u_projection * position;\n }"),i}return f.default(t,e),m.default(t,[{key:"constrainCamera",value:function(e){var t=e.view_height,r=e.height,n=e.focal_length,i=e.fov;return r?(n=2*r/t,i=2*Math.atan(1/n)):(n?i=2*Math.atan(1/n):i&&(i=i*Math.PI/180,n=1/Math.tan(i/2)),r=t/2*n),{view_height:t,height:r,focal_length:n,fov:i}}},{key:"updateMatrices",value:function(){var e=this.view.size.css.height*this.view.meters_per_pixel,t=this.constrainCamera({view_height:e,focal_length:g.default.interpolate(this.view.zoom,this.focal_length),fov:g.default.interpolate(this.view.zoom,this.fov)}),r=t.height,n=t.fov,i=[this.view.center.meters.x,this.view.center.meters.y,r];this.position_meters=i,b.mat4.lookAt(this.view_matrix,b.vec3.fromValues(i[0],i[1],0),b.vec3.fromValues(i[0],i[1],-1),b.vec3.fromValues(0,1,0)),b.mat4.perspective(this.projection_matrix,n,this.view.aspect,1,2*r),this.vanishing_point_skew[0]=this.vanishing_point[0]/this.view.size.css.width,this.vanishing_point_skew[1]=this.vanishing_point[1]/this.view.size.css.height,this.projection_matrix[8]=2*-this.vanishing_point_skew[0],this.projection_matrix[9]=2*-this.vanishing_point_skew[1],b.mat4.translate(this.projection_matrix,this.projection_matrix,b.vec3.fromValues(e/2*this.view.aspect*2*-this.vanishing_point_skew[0],e/2*2*-this.vanishing_point_skew[1],0)),b.mat4.translate(this.projection_matrix,this.projection_matrix,b.vec3.fromValues(0,0,-r))}},{key:"update",value:function(){u.default(a.default(t.prototype),"update",this).call(this),this.updateMatrices()}},{key:"setupProgram",value:function(e){e.uniform("Matrix4fv","u_projection",this.projection_matrix),e.uniform("3f","u_eye",[0,0,this.position_meters[2]]),e.uniform("2fv","u_vanishing_point",this.vanishing_point_skew)}}]),t}(x),k=function(e){function t(e,r){var n=arguments.length<=2||void 0===arguments[2]?{}:arguments[2];d.default(this,t);var i=s.default(this,a.default(t).call(this,e,r,n));return i.type="isometric",i.axis=n.axis||{x:0,y:1},2===i.axis.length&&(i.axis={x:i.axis[0],y:i.axis[1]}),i.position_meters=null,i.viewport_height=null,i.view_matrix=new Float64Array(16),i.projection_matrix=new Float32Array(16),y.default.replaceBlock("camera","\n uniform mat4 u_projection;\n uniform vec3 u_eye;\n uniform vec2 u_vanishing_point;\n\n void cameraProjection (inout vec4 position) {\n position = u_projection * position;\n // position.xy += position.z * u_isometric_axis;\n\n // Reverse z for depth buffer so up is negative,\n // and scale down values so objects higher than one screen height will not get clipped\n // pull forward slightly to avoid going past far clipping plane\n position.z = -position.z / 100. + 1. - 0.001;\n }"),i}return f.default(t,e),m.default(t,[{key:"update",value:function(){u.default(a.default(t.prototype),"update",this).call(this),this.viewport_height=this.view.size.css.height*this.view.meters_per_pixel;var e=[this.view.center.meters.x,this.view.center.meters.y,this.viewport_height];this.position_meters=e,b.mat4.identity(this.view_matrix),b.mat4.translate(this.view_matrix,this.view_matrix,b.vec3.fromValues(-e[0],-e[1],0)),b.mat4.identity(this.projection_matrix),this.projection_matrix[8]=this.axis.x/this.view.aspect,this.projection_matrix[9]=this.axis.y,b.mat4.scale(this.projection_matrix,this.projection_matrix,b.vec3.fromValues(2/this.view.size.meters.x,2/this.view.size.meters.y,2/this.view.size.meters.y))}},{key:"setupProgram",value:function(e){e.uniform("Matrix4fv","u_projection",this.projection_matrix),e.uniform("3fv","u_eye",[0,0,this.viewport_height]),e.uniform("2fv","u_vanishing_point",[0,0])}}]),t}(x),A=function(e){function t(e,r){var n=arguments.length<=2||void 0===arguments[2]?{}:arguments[2];d.default(this,t);var i=s.default(this,a.default(t).call(this,e,r,n));return i.type="flat",i}return f.default(t,e),m.default(t,[{key:"update",value:function(){this.axis.x=0,this.axis.y=0,u.default(a.default(t.prototype),"update",this).call(this)}}]),t}(k)},{"./gl/shader_program":305,"./utils/gl-matrix":351,"./utils/utils":358,"babel-runtime/core-js/object/get-prototype-of":14,"babel-runtime/helpers/classCallCheck":21,"babel-runtime/helpers/createClass":22,"babel-runtime/helpers/get":24,"babel-runtime/helpers/inherits":25,"babel-runtime/helpers/possibleConstructorReturn":26}],299:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(r,"__esModule",{value:!0});var i,a=e("babel-runtime/core-js/get-iterator"),o=n(a),s=e("babel-runtime/helpers/slicedToArray"),l=n(s);r.default=i={},i.default_source_max_zoom=18,i.default_view_max_zoom=20,i.tile_size=256,i.half_circumference_meters=20037508.342789244,i.circumference_meters=2*i.half_circumference_meters,i.min_zoom_meters_per_pixel=i.circumference_meters/i.tile_size;var u=[];i.metersPerPixel=function(e){return u[e]=u[e]||i.min_zoom_meters_per_pixel/Math.pow(2,e),u[e]};var c=[];i.metersPerTile=function(e){return c[e]=c[e]||i.circumference_meters/Math.pow(2,e),c[e]},i.tile_scale=4096,i.units_per_pixel=i.tile_scale/i.tile_size,i.height_scale=16;var f=[];i.unitsPerMeter=function(e){return f[e]=f[e]||i.tile_scale/(i.tile_size*i.metersPerPixel(e)),f[e]},i.metersForTile=function(e){return{x:e.x*i.circumference_meters/Math.pow(2,e.z)-i.half_circumference_meters,y:-(e.y*i.circumference_meters/Math.pow(2,e.z)-i.half_circumference_meters)}},i.tileForMeters=function(e,t){var r=l.default(e,2),n=r[0],a=r[1];return{x:Math.floor((n+i.half_circumference_meters)/(i.circumference_meters/Math.pow(2,t))),y:Math.floor((-a+i.half_circumference_meters)/(i.circumference_meters/Math.pow(2,t))),z:t}},i.wrapTile=function(e){var t=e.x,r=e.y,n=e.z,i=arguments.length<=1||void 0===arguments[1]?{x:!0,y:!1}:arguments[1],a=(1<<n)-1;return i.x&&(t&=a),i.y&&(r&=a),{x:t,y:r,z:n}},i.metersToLatLng=function(e){var t=l.default(e,2),r=t[0],n=t[1];return r/=i.half_circumference_meters,n/=i.half_circumference_meters,n=(2*Math.atan(Math.exp(n*Math.PI))-Math.PI/2)/Math.PI,r*=180,n*=180,[r,n]},i.latLngToMeters=function(e){var t=l.default(e,2),r=t[0],n=t[1];return n=Math.log(Math.tan(n*Math.PI/360+Math.PI/4))/Math.PI,n*=i.half_circumference_meters,r*=i.half_circumference_meters/180,[r,n]},i.wrapLng=function(e){return(e>180||-180>e)&&(e=((e+180)%360+360)%360-180),e},i.transformGeometry=function(e,t){null!=e&&("Point"===e.type?t(e.coordinates):"LineString"===e.type||"MultiPoint"===e.type?e.coordinates.forEach(t):"Polygon"===e.type||"MultiLineString"===e.type?e.coordinates.forEach(function(e){return e.forEach(t)}):"MultiPolygon"===e.type&&e.coordinates.forEach(function(e){e.forEach(function(e){return e.forEach(t)})}))},i.boxIntersect=function(e,t){return!(t.sw.x>e.ne.x||t.ne.x<e.sw.x||t.sw.y>e.ne.y||t.ne.y<e.sw.y)},i.findBoundingBox=function(e){for(var t=1/0,r=-1/0,n=1/0,i=-1/0,a=e[0].length,o=0;a>o;o++){var s=e[0][o];s[0]<t&&(t=s[0]),s[1]<n&&(n=s[1]),s[0]>r&&(r=s[0]),s[1]>i&&(i=s[1])}return[t,n,r,i]},i.geometryType=function(e){return"Polygon"===e||"MultiPolygon"===e?"polygon":"LineString"===e||"MultiLineString"===e?"line":"Point"===e||"MultiPoint"===e?"point":void 0},i.centroid=function(e){for(var t=0,r=0,n=0,i=e[0],a=i.length,o=0,s=a-1;a>o;s=o,o++){var l=i[o],u=i[s],c=l[1]*u[0]-u[1]*l[0];t+=(l[0]+u[0])*c,r+=(l[1]+u[1])*c,n+=3*c}return[t/n,r/n]},i.multiCentroid=function(e){for(var t=e.length,r=[0,0],n=0;n<e.length;n++){var a=i.centroid(e[n]);r[0]+=a[0],r[1]+=a[1]}return r[0]/=t,r[1]/=t,r},i.signedPolygonRingAreaSum=function(e){for(var t=0,r=e.length,n=0;r-1>n;n++){var i=e[n],a=e[n+1];t+=i[0]*a[1]-a[0]*i[1]}return t+=e[r-1][0]*e[0][1]-e[0][0]*e[r-1][1]},i.polygonRingArea=function(e){return Math.abs(i.signedPolygonRingAreaSum(e))/2},i.polygonArea=function(e){return i.polygonRingArea(e[0])},i.multiPolygonArea=function(e){for(var t=0,r=0;r<e.length;r++)t+=i.polygonArea(e[r]);return t},i.ringWinding=function(e){var t=i.signedPolygonRingAreaSum(e);return t>0?"CW":0>t?"CCW":void 0},i.enforceWinding=function(e,t){var r=void 0;if("Polygon"===e.type)r=[e.coordinates];else{if("MultiPolygon"!==e.type)return e; 11 r=e.coordinates}for(var n=0;n<r.length;n++){var a=r[n];if(i.ringWinding(a[0])!==t){var s=!0,l=!1,u=void 0;try{for(var c,f=o.default(a);!(s=(c=f.next()).done);s=!0){var h=c.value;h.reverse()}}catch(d){l=!0,u=d}finally{try{!s&&f.return&&f.return()}finally{if(l)throw u}}}}return e}},{"babel-runtime/core-js/get-iterator":4,"babel-runtime/helpers/slicedToArray":27}],300:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n;r.default=n={},n.BYTE=5120,n.UNSIGNED_BYTE=5121,n.SHORT=5122,n.UNSIGNED_SHORT=5123,n.INT=5124,n.UNSIGNED_INT=5125,n.FLOAT=5126},{}],301:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n;r.default=n={},n.getContext=function(e,t){var r=!1;null==e&&(e=document.createElement("canvas"),e.style.position="absolute",e.style.top=0,e.style.left=0,e.style.zIndex=-1,document.body.appendChild(e),r=!0);var i=e.getContext("webgl",t)||e.getContext("experimental-webgl",t);if(!i)throw new Error("Couldn't create WebGL context.");return r?(n.resize(i,window.innerWidth,window.innerHeight,t.device_pixel_ratio),window.addEventListener("resize",function(){n.resize(i,window.innerWidth,window.innerHeight,t.device_pixel_ratio)})):n.resize(i,parseFloat(e.style.width),parseFloat(e.style.height),t.device_pixel_ratio),i},n.resize=function(e,t,r,n){n=n||window.devicePixelRatio||1,e.canvas.style.width=t+"px",e.canvas.style.height=r+"px",e.canvas.width=Math.round(t*n),e.canvas.height=Math.round(r*n),e.bindFramebuffer(e.FRAMEBUFFER,null),e.viewport(0,0,e.canvas.width,e.canvas.height)}},{}],302:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function i(e,t){var r=s.get(e);return r||(s.set(e,new o.default),r=s.get(e)),r.get(t)||r.set(t,e.getExtension(t)),r.get(t)}Object.defineProperty(r,"__esModule",{value:!0});var a=e("babel-runtime/core-js/map"),o=n(a);r.default=i;var s=new o.default},{"babel-runtime/core-js/map":7}],303:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(r,"__esModule",{value:!0});var i=e("babel-runtime/helpers/toConsumableArray"),a=n(i),o={};r.default=o,o.parseUniforms=function(e){var t=[];for(var r in e){var n,i=r,a=e[r];if("number"==typeof a)t.push({type:"float",method:"1f",name:r,value:a,key:i,uniforms:e});else if(Array.isArray(a)){if("number"==typeof a[0])a.length>=2&&a.length<=4?t.push({type:"vec"+a.length,method:a.length+"fv",name:r,value:a,key:i,uniforms:e}):a.length>4&&t.push({type:"float[]",method:"1fv",name:r+"[0]",value:a,key:i,uniforms:e});else if("string"==typeof a[0])for(n=0;n<a.length;n++)t.push({type:"sampler2D",method:"1i",name:r+"["+n+"]",value:a[n],key:n,uniforms:a});else if(Array.isArray(a[0])&&"number"==typeof a[0][0]&&a[0].length>=2&&a[0].length<=4)for(n=0;n<a.length;n++)t.push({type:"vec"+a[0].length,method:a[n].length+"fv",name:r+"["+n+"]",value:a[n],key:n,uniforms:a})}else"boolean"==typeof a?t.push({type:"bool",method:"1i",name:r,value:a,key:i,uniforms:e}):"string"==typeof a&&t.push({type:"sampler2D",method:"1i",name:r,value:a,key:i,uniforms:e})}return t},o.defineVariable=function(e,t){var r,n;"number"==typeof t?r="float":Array.isArray(t)?"number"==typeof t[0]?t.length>=2&&t.length<=4?r="vec"+t.length:(r="float",n=t.length):"string"==typeof t[0]&&(r="sampler2D",n=t.length):"boolean"==typeof t?r="bool":"string"==typeof t&&(r="sampler2D");var i="";return i+=r+" "+e,n&&(i+="["+n+"]"),i+=";\n"},o.defineUniform=function(e,t){return"uniform "+o.defineVariable(e,t)},o.isUniformDefined=function(e,t){var r=new RegExp("uniform[^;]+(?:{[\\s\\S]*})?[^;]*\\b"+e+"\\b","g");return t.match(r)?!0:!1},o.isSymbolReferenced=function(e,t){var r=new RegExp("\\b"+e+"\\b","g");return t.search(r)>=0?!0:!1},o.expandVec3=function(e){var t=arguments.length<=1||void 0===arguments[1]?1:arguments[1],r=void 0;if(Array.isArray(e)){if(2!==e.length)return e;r=[].concat(a.default(e),[t]).map(parseFloat)}else r=[e,e,e].map(parseFloat);return r&&r.every(function(e){return"number"==typeof e&&!isNaN(e)})?r:void 0},o.expandVec4=function(e){var t=arguments.length<=1||void 0===arguments[1]?1:arguments[1],r=void 0;if(Array.isArray(e)){if(3!==e.length)return e;r=[].concat(a.default(e),[t]).map(parseFloat)}else r=[e,e,e,t].map(parseFloat);return r&&r.every(function(e){return"number"==typeof e&&!isNaN(e)})?r:void 0}},{"babel-runtime/helpers/toConsumableArray":28}],304:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(r,"__esModule",{value:!0}),r.RenderState=void 0;var i=e("babel-runtime/core-js/json/stringify"),a=n(i),o=e("babel-runtime/helpers/classCallCheck"),s=n(o),l=e("babel-runtime/helpers/createClass"),u=n(l),c=r.RenderState=function(){function e(t,r){s.default(this,e),r(t),this.value=t,this.setup=r}return u.default(e,[{key:"set",value:function(e){a.default(this.value)!==a.default(e)&&(this.setup(e),this.value=e)}}]),e}(),f=function h(e){s.default(this,h),this.defaults={},this.defaults.culling=!0,this.defaults.culling_face=e.BACK,this.defaults.blending=!1,this.defaults.blending_src=e.ONE_MINUS_SRC_ALPHA,this.defaults.blending_dst=e.ONE_MINUS_SRC_ALPHA,this.defaults.blending_src_alpha=e.ONE,this.defaults.blending_dst_alpha=e.ONE_MINUS_SRC_ALPHA,this.defaults.depth_write=!0,this.defaults.depth_test=!0,e.depthFunc(e.LESS),this.culling=new c({cull:this.defaults.culling,face:this.defaults.culling_face},function(t){t.cull?(e.enable(e.CULL_FACE),e.cullFace(t.face)):e.disable(e.CULL_FACE)}),this.blending=new c({blend:this.defaults.blending,src:this.defaults.blending_src,dst:this.defaults.blending_dst,src_alpha:this.defaults.blending_src_alpha,dst_alpha:this.defaults.blending_dst_alpha},function(t){t.blend?(e.enable(e.BLEND),t.src_alpha&&t.dst_alpha?e.blendFuncSeparate(t.src,t.dst,t.src_alpha,t.dst_alpha):e.blendFunc(t.src,t.dst)):e.disable(e.BLEND)}),this.depth_write=new c({depth_write:this.defaults.depth_write},function(t){e.depthMask(t.depth_write)}),this.depth_test=new c({depth_test:this.defaults.depth_test},function(t){t.depth_test?e.enable(e.DEPTH_TEST):e.disable(e.DEPTH_TEST)})};r.default=f},{"babel-runtime/core-js/json/stringify":6,"babel-runtime/helpers/classCallCheck":21,"babel-runtime/helpers/createClass":22}],305:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(r,"__esModule",{value:!0});var i=e("babel-runtime/helpers/toConsumableArray"),a=n(i),o=e("babel-runtime/core-js/get-iterator"),s=n(o),l=e("babel-runtime/core-js/object/assign"),u=n(l),c=e("babel-runtime/helpers/classCallCheck"),f=n(c),h=e("babel-runtime/helpers/createClass"),d=n(h),p=e("../utils/log"),m=n(p),_=e("./glsl"),g=n(_),v=e("./texture"),y=n(v),b=e("./extensions"),x=n(b),w=e("strip-comments"),k=n(w),A=e("gl-shader-errors"),T=n(A),E=/^\s*#pragma.*$/gm,S=/\\\s*\n/gm,R=function(){function e(t,r,n,i){f.default(this,e),i=i||{},this.gl=t,this.program=null,this.compiled=!1,this.compiling=!1,this.error=null,this.defines=u.default({},i.defines||{}),this.blocks=u.default({},i.blocks||{}),this.block_scopes=u.default({},i.block_scopes||{}),this.extensions=i.extensions||[],this.dependent_uniforms=i.uniforms,this.uniforms={},this.attribs={},this.vertex_source=r,this.fragment_source=n,this.id=e.id++,e.programs[this.id]=this,this.name=i.name}return d.default(e,[{key:"destroy",value:function(){this.gl.useProgram(null),this.gl.deleteProgram(this.program),this.program=null,this.uniforms={},this.attribs={},delete e.programs[this.id],this.compiled=!1}},{key:"use",value:function(){this.compiled&&(e.current!==this&&this.gl.useProgram(this.program),e.current=this)}},{key:"compile",value:function(){if(this.compiling)throw new Error("ShaderProgram.compile(): skipping for "+this.id+" ("+this.name+") because already compiling");this.compiling=!0,this.compiled=!1,this.error=null,this.computed_vertex_source=this.vertex_source,this.computed_fragment_source=this.fragment_source;var t,r=this.checkExtensions(),n=this.buildDefineList(),i=this.buildShaderBlockList();for(var a in i){var o=i[a];if(o&&(!Array.isArray(o)||0!==o.length)){t=new RegExp("^\\s*#pragma\\s+tangram:\\s+"+a+"\\s*$","m");var l=this.computed_vertex_source.match(t),u=this.computed_fragment_source.match(t);if(null!=l||null!=u){var c="";o.forEach(function(e){var t=e.scope+", "+e.key+", "+e.num;c+="\n// tangram-block-start: "+t+"\n",c+=e.source,c+="\n// tangram-block-end: "+t+"\n"}),null!=l&&(this.computed_vertex_source=this.computed_vertex_source.replace(t,c)),null!=u&&(this.computed_fragment_source=this.computed_fragment_source.replace(t,c)),n["TANGRAM_BLOCK_"+a.replace(/[\s-]+/g,"_").toUpperCase()]=!0}}}this.computed_vertex_source=this.computed_vertex_source.replace(E,""),this.computed_fragment_source=this.computed_fragment_source.replace(E,""),this.ensureUniforms(this.dependent_uniforms);var f=this.name?this.name+" / id "+this.id:"id "+this.id,h="// Program: "+f+"\n",d="",p=this.gl.getShaderPrecisionFormat(this.gl.FRAGMENT_SHADER,this.gl.HIGH_FLOAT);d=p&&p.precision>0?"precision highp float;\n":"precision mediump float;\n",n.TANGRAM_VERTEX_SHADER=!0,n.TANGRAM_FRAGMENT_SHADER=!1,this.computed_vertex_source=h+d+e.buildDefineString(n)+this.computed_vertex_source,n.TANGRAM_VERTEX_SHADER=!1,n.TANGRAM_FRAGMENT_SHADER=!0,this.computed_fragment_source=e.buildExtensionString(r)+h+d+e.buildDefineString(n)+this.computed_fragment_source,this.computed_vertex_source=this.computed_vertex_source.replace(S,""),this.computed_fragment_source=this.computed_fragment_source.replace(S,"");try{this.program=e.updateProgram(this.gl,this.program,this.computed_vertex_source,this.computed_fragment_source),this.compiled=!0,this.compiling=!1}catch(m){if(this.program=null,this.compiled=!1,this.compiling=!1,this.error=m,"vertex"===m.type||"fragment"===m.type){this.shader_errors=m.errors;var _=!0,g=!1,v=void 0;try{for(var y,b=s.default(this.shader_errors);!(_=(y=b.next()).done);_=!0){var x=y.value;x.type=m.type,x.block=this.block(m.type,x.line)}}catch(w){g=!0,v=w}finally{try{!_&&b.return&&b.return()}finally{if(g)throw v}}}throw new Error("ShaderProgram.compile(): program "+this.id+" ("+this.name+") error:",m)}this.use(),this.refreshUniforms(),this.refreshAttributes()}},{key:"buildDefineList",value:function(){var t,r={};for(t in e.defines)r[t]=e.defines[t];for(t in this.defines)r[t]=this.defines[t];return r}},{key:"buildShaderBlockList",value:function(){var t=void 0,r={};for(t in e.blocks)if(r[t]=[],Array.isArray(e.blocks[t])){var n;(n=r[t]).push.apply(n,a.default(e.blocks[t].map(function(e,r){return{key:t,source:e,num:r,scope:"ShaderProgram"}})))}else r[t]=[{key:t,source:e.blocks[t],num:0,scope:"ShaderProgram"}];for(t in this.blocks)if(r[t]=r[t]||[],Array.isArray(this.blocks[t]))for(var i=this.block_scopes&&this.block_scopes[t]||[],o=null,s=0,l=0;l<this.blocks[t].length;l++)i[l]!==o&&(o=i[l],s=0),r[t].push({key:t,source:this.blocks[t][l],num:s,scope:o||this.name}),s++;else r[t].push({key:t,source:this.blocks[t],num:0,scope:this.name});return r}},{key:"ensureUniforms",value:function(e){if(e){var t,r=k.default(this.computed_vertex_source),n=k.default(this.computed_fragment_source),i=[],a=[];for(var o in e)t=null,g.default.isUniformDefined(o,r)||(t||(t=g.default.defineUniform(o,e[o])),m.default("trace","Program "+this.name+": "+o+" not defined in vertex shader, injecting: '"+t+"'"),i.push(t)),g.default.isUniformDefined(o,n)||(t||(t=g.default.defineUniform(o,e[o])),m.default("trace","Program "+this.name+": "+o+" not defined in fragment shader, injecting: '"+t+"'"),a.push(t));i.length>0&&(this.computed_vertex_source=i.join("\n")+this.computed_vertex_source),a.length>0&&(this.computed_fragment_source=a.join("\n")+this.computed_fragment_source)}}},{key:"setUniforms",value:function(e){var t=arguments.length<=1||void 0===arguments[1]?!0:arguments[1];if(this.compiled){t&&(this.texture_unit=0);for(var r=g.default.parseUniforms(e),n=0;n<r.length;n++){var i=r[n];"sampler2D"===i.type?this.setTextureUniform(i.name,i.value):this.uniform(i.method,i.name,i.value)}}}},{key:"saveUniforms",value:function(e){var t=e||this.uniforms;for(var r in t){var n=this.uniforms[r];n&&(n.saved_value=n.value)}this.saved_texture_unit=this.texture_unit||0}},{key:"restoreUniforms",value:function(e){var t=e||this.uniforms;for(var r in t){var n=this.uniforms[r];n&&n.saved_value&&(n.value=n.saved_value,this.updateUniform(n))}this.texture_unit=this.saved_texture_unit||0}},{key:"setTextureUniform",value:function(e,t){var r=y.default.textures[t];return null==r?void m.default("warn","Cannot find texture '"+t+"'"):(r.bind(this.texture_unit),this.uniform("1i",e,this.texture_unit),void this.texture_unit++)}},{key:"uniform",value:function t(e,r,n){if(this.compiled){this.uniforms[r]=this.uniforms[r]||{};var t=this.uniforms[r];t.name=r,void 0===t.location&&(t.location=this.gl.getUniformLocation(this.program,r)),t.method=e,t.value=n,this.updateUniform(t)}}},{key:"updateUniform",value:function(e){this.compiled&&e&&null!=e.location&&(this.use(),this.commitUniform(e))}},{key:"commitUniform",value:function(e){var t=e.location,r=e.value;switch(e.method){case"1i":this.gl.uniform1i(t,r);break;case"1f":this.gl.uniform1f(t,r);break;case"2f":this.gl.uniform2f(t,r[0],r[1]);break;case"3f":this.gl.uniform3f(t,r[0],r[1],r[2]);break;case"4f":this.gl.uniform4f(t,r[0],r[1],r[2],r[3]);break;case"1iv":this.gl.uniform1iv(t,r);break;case"3iv":this.gl.uniform3iv(t,r);break;case"1fv":this.gl.uniform1fv(t,r);break;case"2fv":this.gl.uniform2fv(t,r);break;case"3fv":this.gl.uniform3fv(t,r);break;case"4fv":this.gl.uniform4fv(t,r);break;case"Matrix3fv":this.gl.uniformMatrix3fv(t,!1,r);break;case"Matrix4fv":this.gl.uniformMatrix4fv(t,!1,r)}}},{key:"refreshUniforms",value:function(){if(this.compiled)for(var e in this.uniforms){var t=this.uniforms[e];t.location=this.gl.getUniformLocation(this.program,e),this.updateUniform(t)}}},{key:"refreshAttributes",value:function(){this.attribs={}}},{key:"attribute",value:function(e){if(this.compiled){var t=this.attribs[e]=this.attribs[e]||{};return null!=t.location?t:(t.name=e,t.location=this.gl.getAttribLocation(this.program,e),t)}}},{key:"source",value:function(e){return"vertex"===e?this.computed_vertex_source:"fragment"===e?this.computed_fragment_source:void 0}},{key:"lines",value:function(e){var t=this.source(e);return t?t.split("\n"):[]}},{key:"line",value:function(e,t){var r=this.lines(e);return r?r[t]:void 0}},{key:"block",value:function r(e,t){for(var n=this.lines(e),r=void 0,i=0;t>i&&i<n.length;i++){var a=n[i],o=a.match(/\/\/ tangram-block-start: ([A-Za-z0-9_-]+), ([A-Za-z0-9_-]+), (\d+)/);o&&o.length>1?r={scope:o[1],name:o[2],num:o[3]}:(o=a.match(/\/\/ tangram-block-end: ([A-Za-z0-9_-]+), ([A-Za-z0-9_-]+), (\d+)/),o&&o.length>1&&(r=null)),r&&(r.line=null==r.line?-1:r.line+1,r.source=a)}return r}},{key:"checkExtensions",value:function(){var e=[],t=!0,r=!1,n=void 0;try{for(var i,a=s.default(this.extensions);!(t=(i=a.next()).done);t=!0){var o=i.value,l=x.default(this.gl,o),u="TANGRAM_EXTENSION_"+o;this.defines[u]=null!=l,l?e.push(o):m.default("debug","Could not enable extension '"+o+"'")}}catch(c){r=!0,n=c}finally{try{!t&&a.return&&a.return()}finally{if(r)throw n}}return e}}]),e}();r.default=R,R.id=0,R.programs={},R.current=null,R.defines={},R.blocks={},R.buildDefineString=function(e){var t="";for(var r in e)null!=e[r]&&e[r]!==!1&&(t+="boolean"==typeof e[r]&&e[r]===!0?"#define "+r+"\n":"number"==typeof e[r]&&Math.floor(e[r])===e[r]?"#define "+r+" "+e[r].toFixed(1)+"\n":"#define "+r+" "+e[r]+"\n");return t},R.buildExtensionString=function(e){e=e||[];var t="",r=!0,n=!1,i=void 0;try{for(var a,o=s.default(e);!(r=(a=o.next()).done);r=!0){var l=a.value;t+="#ifdef GL_"+l+"\n#extension GL_"+l+" : enable\n#endif\n"}}catch(u){n=!0,i=u}finally{try{!r&&o.return&&o.return()}finally{if(n)throw i}}return t},R.addBlock=function(e){var t;R.blocks[e]=R.blocks[e]||[];for(var r=arguments.length,n=Array(r>1?r-1:0),i=1;r>i;i++)n[i-1]=arguments[i];(t=R.blocks[e]).push.apply(t,n)},R.removeBlock=function(e){R.blocks[e]=[]},R.replaceBlock=function(e){R.removeBlock(e);for(var t=arguments.length,r=Array(t>1?t-1:0),n=1;t>n;n++)r[n-1]=arguments[n];R.addBlock.apply(R,[e].concat(r))},R.updateProgram=function(e,t,r,n){try{var i=R.createShader(e,r,e.VERTEX_SHADER),a=R.createShader(e,n,e.FRAGMENT_SHADER)}catch(o){throw m.default("error",o.message),o}if(e.useProgram(null),null!=t)for(var s=e.getAttachedShaders(t),l=0;l<s.length;l++)e.detachShader(t,s[l]);else t=e.createProgram();if(null==i||null==a)return t;if(e.attachShader(t,i),e.attachShader(t,a),e.deleteShader(i),e.deleteShader(a),e.linkProgram(t),!e.getProgramParameter(t,e.LINK_STATUS)){var u=new Error("WebGL program error:\n VALIDATE_STATUS: "+e.getProgramParameter(t,e.VALIDATE_STATUS)+"\n ERROR: "+e.getError()+"\n --- Vertex Shader ---\n "+r+"\n --- Fragment Shader ---\n "+n),c={type:"program",message:u};throw m.default("error",c.message),c}return t},R.createShader=function(e,t,r){var n=e.createShader(r);if(e.shaderSource(n,t),e.compileShader(n),!e.getShaderParameter(n,e.COMPILE_STATUS)){var i=r===e.VERTEX_SHADER?"vertex":"fragment",a=e.getShaderInfoLog(n),o=T.default(a);throw{type:i,message:a,errors:o}}return n}},{"../utils/log":352,"./extensions":302,"./glsl":303,"./texture":306,"babel-runtime/core-js/get-iterator":4,"babel-runtime/core-js/object/assign":9,"babel-runtime/helpers/classCallCheck":21,"babel-runtime/helpers/createClass":22,"babel-runtime/helpers/toConsumableArray":28,"gl-shader-errors":185,"strip-comments":283}],306:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(r,"__esModule",{value:!0});var i=e("babel-runtime/core-js/get-iterator"),a=n(i),o=e("babel-runtime/core-js/object/keys"),s=n(o),l=e("babel-runtime/core-js/json/stringify"),u=n(l),c=e("babel-runtime/core-js/promise"),f=n(c),h=e("babel-runtime/core-js/object/assign"),d=n(h),p=e("babel-runtime/helpers/classCallCheck"),m=n(p),_=e("babel-runtime/helpers/createClass"),g=n(_),v=e("../utils/log"),y=n(v),b=e("../utils/utils"),x=n(b),w=e("../utils/subscribe"),k=n(w),A=e("../utils/worker_broker"),T=n(A),E=function(){function e(t,r){var n=arguments.length<=2||void 0===arguments[2]?{}:arguments[2];m.default(this,e),this.gl=t,this.texture=t.createTexture(),this.texture&&(this.valid=!0),this.bind(),this.name=r,this.retain_count=0,this.source=null,this.source_type=null,this.config_type=null,this.loading=null,this.loaded=!1,this.filtering=n.filtering,this.sprites=n.sprites,this.texcoords={},this.sizes={},this.setData(1,1,new Uint8Array([0,0,0,255]),{filtering:"nearest"}),e.textures[this.name]&&(this.retain_count=e.textures[this.name].retain_count,e.textures[this.name].retain_count=0,e.textures[this.name].destroy()),e.textures[this.name]=this,e.texture_configs[this.name]=d.default({name:r},n),this.load(n),y.default("trace","creating Texture "+this.name)}return g.default(e,[{key:"destroy",value:function(){var t=arguments.length<=0||void 0===arguments[0]?{}:arguments[0],r=t.force;return this.retain_count>0&&!r?void y.default("error","Texture '"+this.name+"': destroying texture with retain count of '"+this.retain_count+"'"):void(this.valid&&(this.gl.deleteTexture(this.texture),this.texture=null,delete this.data,this.data=null,delete e.textures[this.name],this.valid=!1,y.default("trace","destroying Texture "+this.name)))}},{key:"retain",value:function(){this.retain_count++}},{key:"release",value:function(){this.retain_count<=0&&y.default("error","Texture '"+this.name+"': releasing texture with retain count of '"+this.retain_count+"'"),this.retain_count--,this.retain_count<=0&&this.destroy()}},{key:"bind",value:function(){var t=arguments.length<=0||void 0===arguments[0]?0:arguments[0];this.valid&&(e.activeUnit!==t&&(this.gl.activeTexture(this.gl.TEXTURE0+t),e.activeUnit=t,e.boundTexture=null),e.boundTexture!==this.texture&&(this.gl.bindTexture(this.gl.TEXTURE_2D,this.texture),e.boundTexture=this.texture))}},{key:"load",value:function(e){var t=this;return e?(this.loading=null,"string"==typeof e.url?(this.config_type="url",this.setUrl(e.url,e)):e.element?(this.config_type="element",this.setElement(e.element,e)):e.data&&e.width&&e.height&&(this.config_type="data",this.setData(e.width,e.height,e.data,e)),this.loading=this.loading&&this.loading.then(function(){return t.calculateSprites(),t})||f.default.resolve(this),this.loading):this.loading||f.default.resolve(this)}},{key:"setUrl",value:function(t){var r=this,n=arguments.length<=1||void 0===arguments[1]?{}:arguments[1];return this.valid?(e.base_url&&(t=x.default.addBaseURL(t,e.base_url)),this.url=t,this.source=this.url,this.source_type="url",this.loading=new f.default(function(t){var i=new Image;i.onload=function(){try{r.setElement(i,n)}catch(a){r.loaded=!1,y.default("warn","Texture '"+r.name+"': failed to load url: '"+r.source+"'",a,n),e.trigger("warning",{message:"Failed to load texture from "+r.source,error:a,texture:n})}r.loaded=!0,t(r)},i.onerror=function(i){r.loaded=!1,y.default("warn","Texture '"+r.name+"': failed to load url: '"+r.source+"'",i,n),e.trigger("warning",{message:"Failed to load texture from "+r.source,error:i,texture:n}),t(r)},x.default.isSafari()&&"data:"===r.source.slice(0,5)||(i.crossOrigin="anonymous"),i.src=r.source}),this.loading):void 0}},{key:"setData",value:function(e,t,r){var n=arguments.length<=3||void 0===arguments[3]?{}:arguments[3];return this.width=e,this.height=t,this.source=r,this.source_type="data",Array.isArray(this.source)&&(this.source=new Uint8Array(this.source)),this.update(n),this.setFiltering(n),this.loaded=!0,this.loading=f.default.resolve(this),this.loading}},{key:"setElement",value:function(t,r){var n=t;if("string"==typeof t&&(t=document.querySelector(t)),t instanceof HTMLCanvasElement||t instanceof HTMLImageElement||t instanceof HTMLVideoElement)this.source=t,this.source_type="element",this.update(r),this.setFiltering(r);else{this.loaded=!1;var i="the 'element' parameter (`element: "+u.default(n)+"`) must be a CSS ";i+="selector string, or a <canvas>, <image> or <video> object",y.default("warn","Texture '"+this.name+"': "+i,r),e.trigger("warning",{message:"Failed to load texture because "+i,texture:r})}return this.loaded=!0,this.loading=f.default.resolve(this),this.loading}},{key:"update",value:function(){var t=arguments.length<=0||void 0===arguments[0]?{}:arguments[0];this.valid&&(this.bind(),this.gl.pixelStorei(this.gl.UNPACK_FLIP_Y_WEBGL,t.UNPACK_FLIP_Y_WEBGL===!1?!1:!0),this.gl.pixelStorei(this.gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL,t.UNPACK_PREMULTIPLY_ALPHA_WEBGL||!1),this.source instanceof HTMLCanvasElement||this.source instanceof HTMLVideoElement||this.source instanceof HTMLImageElement&&this.source.complete?(this.width=this.source.width,this.height=this.source.height,this.gl.texImage2D(this.gl.TEXTURE_2D,0,this.gl.RGBA,this.gl.RGBA,this.gl.UNSIGNED_BYTE,this.source)):"data"===this.source_type&&this.gl.texImage2D(this.gl.TEXTURE_2D,0,this.gl.RGBA,this.width,this.height,0,this.gl.RGBA,this.gl.UNSIGNED_BYTE,this.source),e.trigger("update",this))}},{key:"setFiltering",value:function(){var t=arguments.length<=0||void 0===arguments[0]?{}:arguments[0];if(this.valid){t.filtering=t.filtering||"linear";var r=this.gl;this.bind(),x.default.isPowerOf2(this.width)&&x.default.isPowerOf2(this.height)?(this.power_of_2=!0,r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_S,t.TEXTURE_WRAP_S||t.repeat&&r.REPEAT||r.CLAMP_TO_EDGE),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_T,t.TEXTURE_WRAP_T||t.repeat&&r.REPEAT||r.CLAMP_TO_EDGE),"mipmap"===t.filtering?(this.filtering="mipmap",r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MIN_FILTER,r.LINEAR_MIPMAP_LINEAR),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MAG_FILTER,r.LINEAR),r.generateMipmap(r.TEXTURE_2D)):"linear"===t.filtering?(this.filtering="linear",r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MIN_FILTER,r.LINEAR),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MAG_FILTER,r.LINEAR)):"nearest"===t.filtering&&(this.filtering="nearest",r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MIN_FILTER,r.NEAREST),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MAG_FILTER,r.NEAREST))):(this.power_of_2=!1,r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_S,r.CLAMP_TO_EDGE),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_T,r.CLAMP_TO_EDGE),"nearest"===t.filtering?(this.filtering="nearest",r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MIN_FILTER,r.NEAREST),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MAG_FILTER,r.NEAREST)):(this.filtering="linear",r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MIN_FILTER,r.LINEAR),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MAG_FILTER,r.LINEAR))),e.trigger("update",this)}}},{key:"calculateSprites",value:function(){if(this.sprites)for(var t in this.sprites){var r=this.sprites[t];this.texcoords[t]=e.getTexcoordsForSprite([r[0],r[1]],[r[2],r[3]],[this.width,this.height]),this.sizes[t]=[r[2],r[3]]}}}]),e}();r.default=E,E.create=function(e,t,r){return new E(e,t,r)},E.retain=function(e){E.textures[e]&&E.textures[e].retain()},E.release=function(e){E.textures[e]&&E.textures[e].release()},E.destroy=function(e){var t=s.default(E.textures),r=!0,n=!1,i=void 0;try{for(var o,l=a.default(t);!(r=(o=l.next()).done);r=!0){var u=o.value,c=E.textures[u];c.gl===e&&c.destroy({force:!0})}}catch(f){n=!0,i=f}finally{try{!r&&l.return&&l.return()}finally{if(n)throw i}}},E.getSpriteInfo=function(e,t){var r=E.textures[e];return r&&{size:r.sizes[t],texcoords:r.texcoords[t]}},E.getTexcoordsForSprite=function(e,t,r){var n=r[1]-e[1]-t[1];return[e[0]/r[0],n/r[1],(t[0]+e[0])/r[0],(t[1]+n)/r[1]]},E.createFromObject=function(e,t){var r=[];if(t)for(var n in t){var i=t[n];if(E.changed(n,i)){var a=E.create(e,n,i);r.push(a.loading)}}return f.default.all(r)},E.default="__default",E.createDefault=function(e){return E.create(e,E.default)},E.changed=function(e,t){var r=E.textures[e];if(r){if("element"===r.config_type||null!=t.element)return!0;if(u.default(E.texture_configs[e])===u.default(d.default({name:e},t)))return!1}return!0},E.getInfo=function(e){if(e||(e=s.default(E.textures)),Array.isArray(e))return f.default.all(e.map(function(e){return E.getInfo(e)}));var t=E.textures[e];if(t){var r=t.loading||f.default.resolve(t);return r.then(function(){return{name:t.name,width:t.width,height:t.height,sprites:t.sprites,texcoords:t.texcoords,sizes:t.sizes,filtering:t.filtering,power_of_2:t.power_of_2,valid:t.valid}})}return f.default.resolve(null)},E.syncTexturesToWorker=function(e){return T.default.postMessage("Texture.getInfo",e).then(function(e){var t=!0,r=!1,n=void 0;try{for(var i,o=a.default(e);!(t=(i=o.next()).done);t=!0){var s=i.value;E.textures[s.name]=s}}catch(l){r=!0,n=l}finally{try{!t&&o.return&&o.return()}finally{if(r)throw n}}return E.textures})},E.getMaxTextureSize=function(e){return e.getParameter(e.MAX_TEXTURE_SIZE)},E.textures={},E.texture_configs={},E.boundTexture=null,E.activeUnit=null,E.base_url=null,T.default.addTarget("Texture",E),k.default(E)},{"../utils/log":352,"../utils/subscribe":356,"../utils/utils":358,"../utils/worker_broker":360,"babel-runtime/core-js/get-iterator":4,"babel-runtime/core-js/json/stringify":6,"babel-runtime/core-js/object/assign":9,"babel-runtime/core-js/object/keys":15,"babel-runtime/core-js/promise":17,"babel-runtime/helpers/classCallCheck":21,"babel-runtime/helpers/createClass":22}],307:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(r,"__esModule",{value:!0});var i,a=e("babel-runtime/core-js/map"),o=n(a),s=e("../utils/log"),l=n(s);r.default=i={},i.disabled=!1,i.ext=new o.default,i.bound_vao=new o.default,i.init=function(e){i.disabled!==!0&&i.ext.set(e,e.getExtension("OES_vertex_array_object")),null!=i.ext.get(e)?l.default("info","Vertex Array Object extension available"):i.disabled!==!0?l.default("warn","Vertex Array Object extension NOT available"):l.default("warn","Vertex Array Object extension force disabled")},i.create=function(e,t,r){var n={};n.setup=t,n.teardown=r;var a=i.ext.get(e);return null!=a&&(n._vao=a.createVertexArrayOES(),a.bindVertexArrayOES(n._vao)),n.setup(!0),n},i.bind=function(e,t){var r=i.ext.get(e);if(null!=t)null!=r&&null!=t._vao?(r.bindVertexArrayOES(t._vao),i.bound_vao.set(e,t)):t.setup(!1);else{var n=i.bound_vao.get(e);null!=r?r.bindVertexArrayOES(null):null!=n&&"function"==typeof n.teardown&&n.teardown(),i.bound_vao.set(e,null)}},i.destroy=function(e,t){var r=i.ext.get(e);null!=r&&null!=t&&null!=t._vao&&(r.deleteVertexArrayOES(t._vao),t._vao=null)}},{"../utils/log":352,"babel-runtime/core-js/map":7}],308:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(r,"__esModule",{value:!0});var i=e("babel-runtime/core-js/get-iterator"),a=n(i),o=e("babel-runtime/core-js/map"),s=n(o),l=e("babel-runtime/helpers/classCallCheck"),u=n(l),c=e("babel-runtime/helpers/createClass"),f=n(c),h=e("../utils/log"),d=n(h),p=e("./shader_program"),m=n(p),_=e("./vao"),g=n(_),v=function(){function e(t,r,n,i,a){u.default(this,e),a=a||{},this.gl=t,this.vertex_data=r,this.element_data=n,this.vertex_layout=i,this.vertex_buffer=this.gl.createBuffer(),this.draw_mode=a.draw_mode||this.gl.TRIANGLES,this.data_usage=a.data_usage||this.gl.STATIC_DRAW,this.vertices_per_geometry=3,this.uniforms=a.uniforms,this.retain=a.retain||!1,this.created_at=+new Date,this.fade_in_time=a.fade_in_time||0,this.vertex_count=this.vertex_data.byteLength/this.vertex_layout.stride,this.vaos=new s.default,this.toggle_element_array=!1,this.element_data?(this.toggle_element_array=!0,this.element_count=this.element_data.length,this.geometry_count=this.element_count/this.vertices_per_geometry,this.element_type=this.element_data.constructor===Uint16Array?this.gl.UNSIGNED_SHORT:this.gl.UNSIGNED_INT,this.element_buffer=this.gl.createBuffer(),this.gl.bindBuffer(this.gl.ELEMENT_ARRAY_BUFFER,this.element_buffer),this.gl.bufferData(this.gl.ELEMENT_ARRAY_BUFFER,this.element_data,this.data_usage)):this.geometry_count=this.vertex_count/this.vertices_per_geometry,this.gl.bindBuffer(this.gl.ARRAY_BUFFER,this.vertex_buffer),this.gl.bufferData(this.gl.ARRAY_BUFFER,this.vertex_data,this.data_usage),this.retain||(delete this.vertex_data,delete this.element_data),this.valid=!0}return f.default(e,[{key:"render",value:function(){var e=arguments.length<=0||void 0===arguments[0]?{}:arguments[0];if(!this.valid)return!1;var t=e.program||m.default.current;t.use(),this.uniforms&&(t.saveUniforms(this.uniforms),t.setUniforms(this.uniforms,!1));var r=(+new Date-this.created_at)/1e3;return t.uniform("1f","u_visible_time",r),this.bind(t),this.toggle_element_array?this.gl.drawElements(this.draw_mode,this.element_count,this.element_type,0):this.gl.drawArrays(this.draw_mode,0,this.vertex_count),g.default.bind(this.gl,null),this.uniforms&&t.restoreUniforms(this.uniforms),r<this.fade_in_time}},{key:"bind",value:function(e){var t=this,r=this.vaos.get(e);r?g.default.bind(this.gl,r):this.vaos.set(e,g.default.create(this.gl,function(r){t.gl.bindBuffer(t.gl.ARRAY_BUFFER,t.vertex_buffer),t.toggle_element_array&&t.gl.bindBuffer(t.gl.ELEMENT_ARRAY_BUFFER,t.element_buffer),t.vertex_layout.enable(t.gl,e,r)}))}},{key:"destroy",value:function(){if(!this.valid)return!1;this.valid=!1;var e=!0,t=!1,r=void 0;try{for(var n,i=a.default(this.vaos.values());!(e=(n=i.next()).done);e=!0){var o=n.value;g.default.destroy(this.gl,o)}}catch(s){t=!0,r=s}finally{try{!e&&i.return&&i.return()}finally{if(t)throw r}}return d.default("trace","VBOMesh.destroy: delete buffer"+(this.vertex_data?" of size "+this.vertex_data.byteLength:"")),this.gl.deleteBuffer(this.vertex_buffer),this.vertex_buffer=null,this.element_buffer&&(this.gl.deleteBuffer(this.element_buffer),this.element_buffer=null),delete this.vertex_data,delete this.element_data,!0}}]),e}();r.default=v},{"../utils/log":352,"./shader_program":305,"./vao":307,"babel-runtime/core-js/get-iterator":4,"babel-runtime/core-js/map":7,"babel-runtime/helpers/classCallCheck":21,"babel-runtime/helpers/createClass":22}],309:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(r,"__esModule",{value:!0}); 12 var i,a=e("babel-runtime/helpers/toConsumableArray"),o=n(a),s=e("babel-runtime/core-js/get-iterator"),l=n(s),u=e("babel-runtime/helpers/classCallCheck"),c=n(u),f=e("babel-runtime/helpers/createClass"),h=n(f),d=e("babel-runtime/helpers/defineProperty"),p=n(d),m=e("./constants"),_=n(m),g=e("../utils/log"),v=n(g),y=e("./vertex_elements"),b=n(y),x=(i={},p.default(i,_.default.FLOAT,Float32Array),p.default(i,_.default.BYTE,Int8Array),p.default(i,_.default.UNSIGNED_BYTE,Uint8Array),p.default(i,_.default.INT,Int32Array),p.default(i,_.default.UNSIGNED_INT,Uint32Array),p.default(i,_.default.SHORT,Int16Array),p.default(i,_.default.UNSIGNED_SHORT,Uint16Array),i),w=function(){function e(t){var r=arguments.length<=1||void 0===arguments[1]?{}:arguments[1],n=r.prealloc,i=void 0===n?500:n;c.default(this,e),this.vertex_layout=t,this.vertex_elements=new b.default,e.array_pool.length>0?(this.vertex_buffer=e.array_pool.pop(),this.byte_length=this.vertex_buffer.byteLength,this.size=Math.floor(this.byte_length/this.vertex_layout.stride),v.default("trace","VertexData: reused buffer of bytes "+this.byte_length+", "+this.size+" vertices")):(this.size=i,this.byte_length=this.vertex_layout.stride*this.size,this.vertex_buffer=new Uint8Array(this.byte_length)),this.offset=0,this.components=[];var a=!0,s=!1,u=void 0;try{for(var f,h=l.default(this.vertex_layout.components);!(a=(f=h.next()).done);a=!0){var d=f.value;this.components.push([].concat(o.default(d)))}}catch(p){s=!0,u=p}finally{try{!a&&h.return&&h.return()}finally{if(s)throw u}}this.vertex_count=0,this.realloc_count=0,this.setBufferViews()}return h.default(e,[{key:"setBufferViews",value:function(){this.views={},this.views[_.default.UNSIGNED_BYTE]=this.vertex_buffer;var e=!0,t=!1,r=void 0;try{for(var n,i=l.default(this.vertex_layout.attribs);!(e=(n=i.next()).done);e=!0){var a=n.value;if(null==this.views[a.type]){var o=x[a.type];this.views[a.type]=new o(this.vertex_buffer.buffer)}}}catch(s){t=!0,r=s}finally{try{!e&&i.return&&i.return()}finally{if(t)throw r}}var u=!0,c=!1,f=void 0;try{for(var h,d=l.default(this.components);!(u=(h=d.next()).done);u=!0){var p=h.value;p[1]=this.views[p[0]]}}catch(s){c=!0,f=s}finally{try{!u&&d.return&&d.return()}finally{if(c)throw f}}}},{key:"checkBufferSize",value:function(){if(this.offset+this.vertex_layout.stride>this.byte_length){this.size=Math.floor(1.5*this.size),this.size-=this.size%4,this.byte_length=this.vertex_layout.stride*this.size;var t=new Uint8Array(this.byte_length);t.set(this.vertex_buffer),e.array_pool.push(this.vertex_buffer),this.vertex_buffer=t,this.setBufferViews(),this.realloc_count++}}},{key:"addVertex",value:function(e){this.checkBufferSize();for(var t=0,r=this.components.length,n=0;r>n;n++){var i=this.components[n];i[1][(this.offset>>i[2])+i[3]]=e[t++]}this.offset+=this.vertex_layout.stride,this.vertex_count++}},{key:"end",value:function(){return this.vertex_buffer=this.vertex_buffer.subarray(0,this.offset),this.element_buffer=this.vertex_elements.end(),v.default("trace","VertexData: "+this.size+" vertices total, realloc count "+this.realloc_count),this}}]),e}();r.default=w,w.array_pool=[]},{"../utils/log":352,"./constants":300,"./vertex_elements":310,"babel-runtime/core-js/get-iterator":4,"babel-runtime/helpers/classCallCheck":21,"babel-runtime/helpers/createClass":22,"babel-runtime/helpers/defineProperty":23,"babel-runtime/helpers/toConsumableArray":28}],310:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function i(e,t){var r=t&&h?Uint32Array:Uint16Array;return new r(e)}Object.defineProperty(r,"__esModule",{value:!0});var a=e("babel-runtime/helpers/classCallCheck"),o=n(a),s=e("babel-runtime/helpers/createClass"),l=n(s),u=e("../utils/worker_broker"),c=n(u),f=Math.pow(2,16)-1,h=!1,d=function(){function e(){o.default(this,e),this.array=[],this.has_overflown=!1}return l.default(e,[{key:"push",value:function(e){(!this.has_overflown||h)&&(e>f&&(this.has_overflown=!0,!h)||this.array.push(e))}},{key:"end",value:function(){if(this.array.length){var e=i(this.array,this.has_overflown);return this.array=[],this.has_overflown=!1,e}return!1}}]),e}();r.default=d,d.setUint32Flag=function(e){h=e},c.default.addTarget("VertexElements",d)},{"../utils/worker_broker":360,"babel-runtime/helpers/classCallCheck":21,"babel-runtime/helpers/createClass":22}],311:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(r,"__esModule",{value:!0});var i=e("babel-runtime/core-js/get-iterator"),a=n(i),o=e("babel-runtime/helpers/classCallCheck"),s=n(o),l=e("babel-runtime/helpers/createClass"),u=n(l),c=e("./constants"),f=n(c),h=e("./vertex_data"),d=n(h),p=function(){function e(t){s.default(this,e),this.attribs=t,this.components=[],this.index={},this.stride=0;var r=0,n=!0,i=!1,o=void 0;try{for(var l,u=a.default(this.attribs);!(n=(l=u.next()).done);n=!0){var c=l.value;c.offset=this.stride,c.byte_size=c.size;var h=0;switch(c.type){case f.default.FLOAT:case f.default.INT:case f.default.UNSIGNED_INT:c.byte_size*=4,h=2;break;case f.default.SHORT:case f.default.UNSIGNED_SHORT:c.byte_size*=2,h=1}this.stride+=c.byte_size,3&this.stride&&(this.stride+=4-(3&this.stride));var d=c.offset>>h;if(c.size>1)for(var p=0;p<c.size;p++)this.components.push([c.type,null,h,d++]);else this.components.push([c.type,null,h,d]);this.index[c.name]=r,r+=c.size}}catch(m){i=!0,o=m}finally{try{!n&&u.return&&u.return()}finally{if(i)throw o}}}return u.default(e,[{key:"enable",value:function(t,r,n){for(var i,a,o=0;o<this.attribs.length;o++)i=this.attribs[o],a=r.attribute(i.name).location,-1!==a&&((!e.enabled_attribs[a]||n)&&t.enableVertexAttribArray(a),t.vertexAttribPointer(a,i.size,i.type,i.normalized,this.stride,i.offset),e.enabled_attribs[a]=r);for(a in e.enabled_attribs)this.disableUnusedAttribute(t,a,r)}},{key:"disableUnusedAttribute",value:function(t,r,n){e.enabled_attribs[r]!==n&&(t.disableVertexAttribArray(r),delete e.enabled_attribs[r])}},{key:"createVertexData",value:function(){return new d.default(this)}}]),e}();r.default=p,p.enabled_attribs={}},{"./constants":300,"./vertex_data":309,"babel-runtime/core-js/get-iterator":4,"babel-runtime/helpers/classCallCheck":21,"babel-runtime/helpers/createClass":22}],312:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(r,"__esModule",{value:!0});var i,a=e("babel-runtime/core-js/get-iterator"),o=n(a),s=e("babel-runtime/core-js/object/keys"),l=n(s),u=e("babel-runtime/core-js/promise"),c=n(u),f=e("babel-runtime/core-js/set"),h=n(f),d=e("./repeat_group"),p=n(d),m=e("../utils/log"),_=n(m);r.default=i={tiles:{},link_id:0,nextLinkId:function(){return this.link_id++},startTile:function(e){var t=this.tiles[e]={bboxes:{aabb:[],obb:[]},objects:{},keep:{},styles:new h.default};t.complete=new c.default(function(e,r){t.resolve=e,t.reject=r})},resetTile:function(e){delete this.tiles[e]},addStyle:function(e,t){this.tiles[t].styles.add(e)},collide:function(e,t,r){var n=this.tiles[r];if(!n)return _.default("trace","Collision.collide() called with null tile",r,this.tiles,t,e),c.default.resolve([]);for(var i=n.objects,a=0;a<e.length;a++){var o=e[a],s=o.label.layout.priority;i[s]=i[s]||{},i[s][t]=i[s][t]||[],i[s][t].push(o)}return n.styles.delete(t),0===n.styles.size&&this.endTile(r),n.complete.then(function(){return n.keep[t]||[]})},endTile:function(e){var t=this.tiles[e],r=t.keep;p.default.clear(e);var n=l.default(t.objects).sort(function(e,t){return e-t}),i=!0,a=!1,s=void 0;try{for(var u,c=o.default(n);!(i=(u=c.next()).done);i=!0){var f=u.value,h=t.objects[f];if(h)for(var d in h){var m=h[d];r[d]=r[d]||[];for(var _=0;_<m.length;_++){var g=m[_];this.canBePlaced(g,e,g.linked)&&(g.linked?this.canBePlaced(g.linked,e,g)&&(r[d].push(g),this.place(g,e),this.place(g.linked,e)):(r[d].push(g),this.place(g,e)))}}}}catch(v){a=!0,s=v}finally{try{!i&&c.return&&c.return()}finally{if(a)throw s}}delete this.tiles[e],t.resolve()},canBePlaced:function(e,t){var r=arguments.length<=2||void 0===arguments[2]?null:arguments[2],n=e.label,i=e.label.layout;if(null!=n.placed)return n.placed;var a=this.tiles[t].bboxes;if(i.collide&&n.discard(a,r&&r.label))i.collide&&(n.placed=!1);else{var o=p.default.check(n,i,t);if(!o)return!0;n.placed=!1}return n.placed},place:function(e,t){var r=e.label;null==r.placed&&(p.default.add(r,r.layout,t),r.add(this.tiles[t].bboxes))}}},{"../utils/log":352,"./repeat_group":317,"babel-runtime/core-js/get-iterator":4,"babel-runtime/core-js/object/keys":15,"babel-runtime/core-js/promise":17,"babel-runtime/core-js/set":18}],313:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(r,"__esModule",{value:!0});var i=e("babel-runtime/helpers/classCallCheck"),a=n(i),o=e("babel-runtime/helpers/createClass"),s=n(o),l=e("./point_anchor"),u=n(l),c=e("box-intersect"),f=n(c),h=e("../utils/utils"),d=n(h),p=e("../utils/obb"),m=n(p),_=function(){function e(t){var r=arguments.length<=1||void 0===arguments[1]?{}:arguments[1];a.default(this,e),this.size=t,this.layout=r,this.position=null,this.anchor=Array.isArray(this.layout.anchor)?this.layout.anchor[0]:this.layout.anchor,this.placed=null,this.offset=r.offset,this.aabb=null,this.obb=null,this.align="center",this.throw_away=!1}return s.default(e,[{key:"update",value:function(){this.align=this.layout.align||u.default.alignForAnchor(this.anchor)}},{key:"occluded",value:function(e){var t=this,r=arguments.length<=1||void 0===arguments[1]?null:arguments[1],n=!1,i=e.aabb,a=e.obb;return i.length>0&&f.default([this.aabb],i,function(e,o){return r&&i[o]===r.aabb?void 0:0===t.obb.angle&&0===a[o].angle?(n=!0,!0):m.default.intersect(t.obb,a[o])?(n=!0,!0):void 0}),n}},{key:"add",value:function(e){this.placed=!0,e.aabb.push(this.aabb),e.obb.push(this.obb)}},{key:"inTileBounds",value:function(){var e=[this.aabb[0],this.aabb[1]],t=[this.aabb[2],this.aabb[3]];return d.default.pointInTile(e)&&d.default.pointInTile(t)?!0:!1}},{key:"discard",value:function(e){var t=arguments.length<=1||void 0===arguments[1]?null:arguments[1];return this.throw_away?!0:this.occluded(e,t)}}]),e}();r.default=_,_.epsilon=.9999},{"../utils/obb":355,"../utils/utils":358,"./point_anchor":316,"babel-runtime/helpers/classCallCheck":21,"babel-runtime/helpers/createClass":22,"box-intersect":33}],314:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function i(e,t,r,n,i,a){var o=void 0,s=void 0;return!i||0===i[0]&&0===i[1]?(o=e[0],s=e[1]):(i=_.default.rot(i,n),o=e[0]+i[0]*a,s=e[1]-i[1]*a),new v.default(o,s,-n,t,r)}function a(e,t){var r=Math.PI,n=r/2,i=_.default.sub(e,t),a=Math.atan2(i[0],i[1])+n;return a>n?(a+=r,a%=2*Math.PI):0>a&&(a+=2*r),a}function o(e,t){return 1-e/t}Object.defineProperty(r,"__esModule",{value:!0});var s=e("babel-runtime/core-js/object/create"),l=n(s),u=e("babel-runtime/helpers/classCallCheck"),c=n(u),f=e("babel-runtime/helpers/createClass"),h=n(f),d=e("./label"),p=n(d),m=e("../vector"),_=n(m),g=e("../utils/obb"),v=n(g),y={MID_POINT:0,CORNER:1},b=Math.PI/2,x=.7,w=.6,k=function(){function e(t,r,n){c.default(this,e),this.size=t,this.layout=n,this.lines=r,this.space_width=n.space_width,this.num_segments=t.length,this.total_length=t.reduce(function(e,t){return e+t[0]},0)+(t.length-1)*this.space_width,this.total_height=t[0][1],this.placement=void 0===n.placement?y.MID_POINT:n.placement,this.kink_index=0,this.spread_factor=.5,this.fitness=0,this.position=[],this.angle=[],this.offsets=[],this.obbs=[],this.aabbs=[],this.segment_index=n.segment_index||n.segment_start||0,this.segment_max=n.segment_end||this.lines.length;var i=this.getNextFittingSegment(this.getCurrentSegment());this.throw_away=!i}return h.default(e,[{key:"getNextSegment",value:function(){switch(this.placement){case y.CORNER:this.placement=y.MID_POINT;break;case y.MID_POINT:if(this.segment_index>=this.lines.length-2)return!1;this.size.length>1&&(this.placement=y.CORNER),this.segment_index++}return this.getCurrentSegment()}},{key:"getCurrentSegment",value:function(){var e=void 0,t=void 0,r=void 0;switch(this.placement){case y.CORNER:e=this.lines[this.segment_index-1],t=this.lines[this.segment_index];var n=this.lines[this.segment_index+1];r=[e,t,n];break;case y.MID_POINT:e=this.lines[this.segment_index],t=this.lines[this.segment_index+1],r=[e,t]}return r}},{key:"getNextFittingSegment",value:function(e){return e=e||this.getNextSegment(),e?this.doesSegmentFit(e)&&(this.update(),this.inTileBounds()&&this.inAngleBounds())?e:this.getNextFittingSegment():!1}},{key:"doesSegmentFit",value:function(e){switch(this.placement){case y.CORNER:return this.fitKinkedSegment(e);case y.MID_POINT:return this.fitStraightSegment(e)}}},{key:"fitKinkedSegment",value:function(e){var t=this.layout.units_per_pixel,r=_.default.sub(e[0],e[1]),n=_.default.sub(e[1],e[2]);if(r[0]*n[0]<0&&r[1]*n[1]>0)return!1;for(var i=_.default.length(r)/t,a=_.default.length(n)/t,s=this.total_length,l=0,u=void 0,c=0,f=this.num_segments-1,h=[];f>0;)u=this.size[f][0]+this.space_width,s-=u,l+=u,c=Math.max(o(i,s),o(a,l)),h.unshift(c),f--;var d=Math.max.apply(null,h);return w>d?(this.kink_index=h.indexOf(d)+1,this.fitness=d,!0):(this.kink_index=0,!1)}},{key:"fitStraightSegment",value:function(e){var t=this.layout.units_per_pixel,r=_.default.length(_.default.sub(e[0],e[1]))/t,n=o(r,this.total_length);return x>n?(this.fitness=n,!0):!1}},{key:"update",value:function(){this.angle=this.getCurrentAngle(),this.position=this.getCurrentPosition(),this.updateBBoxes()}},{key:"getCurrentAngle",value:function(){var e=this.getCurrentSegment(),t=[];switch(this.placement){case y.CORNER:for(var r=a(e[0],e[1]),n=a(e[1],e[2]),i=_.default.sub(e[0],e[1]),o=_.default.sub(e[1],e[2]),s=i[0]>=0&&o[0]>=0?1:-1,l=void 0,u=0;u<this.num_segments;u++)l=u<this.kink_index?s>0?n:r:s>0?r:n,t.push(l);break;case y.MID_POINT:for(var c=a(e[0],e[1]),f=0;f<this.num_segments;f++)t.push(c)}return t}},{key:"getCurrentPosition",value:function(){var e=this.getCurrentSegment(),t=void 0;switch(this.placement){case y.CORNER:t=e[1].slice();break;case y.MID_POINT:t=[.5*(e[0][0]+e[1][0]),.5*(e[0][1]+e[1][1])]}return t}},{key:"inAngleBounds",value:function(){switch(this.placement){case y.CORNER:var e=this.angle[0];0>e&&(e+=2*Math.PI);var t=this.angle[1];0>t&&(t+=2*Math.PI);var r=Math.abs(t-e);return r=Math.min(2*Math.PI-r,r),b>=r;case y.MID_POINT:return!0}}},{key:"updateBBoxes",value:function(){var e=this.layout.units_per_pixel,t=(this.total_height+2*this.layout.buffer[1])*e*p.default.epsilon;switch(this.obbs=[],this.aabbs=[],this.placement){case y.CORNER:for(var r=this.angle[this.kink_index-1],n=this.angle[this.kink_index],a=Math.abs(n-r),o=this.spread_factor*Math.abs(this.total_height*Math.tan(.5*a)),s=.5*(-o-this.space_width),l=this.kink_index-1;l>=0;l--){var u=this.size[l][0],c=this.angle[l],f=(u+2*this.layout.buffer[0])*e*p.default.epsilon;s-=.5*u;var h=_.default.rot([s*e,0],-c),d=_.default.add(this.position,h),m=i(d,f,t,c,this.offset,e),g=m.getExtent();this.obbs.push(m),this.aabbs.push(g),this.offsets[l]=[this.layout.offset[0]+s,this.layout.offset[1]],s-=.5*u+this.space_width}s=.5*(o+this.space_width);for(var v=this.kink_index;v<this.num_segments;v++){var b=this.size[v][0],x=this.angle[v],w=(b+2*this.layout.buffer[0])*e*p.default.epsilon;s+=.5*b;var k=_.default.rot([s*e,0],-x),A=_.default.add(this.position,k),T=i(A,w,t,x,this.offset,e),E=T.getExtent();this.obbs.push(T),this.aabbs.push(E),this.offsets[v]=[this.layout.offset[0]+s,this.layout.offset[1]],s+=.5*b+this.space_width}break;case y.MID_POINT:for(var S=-.5*this.total_length,R=0;R<this.num_segments;R++){var j=this.size[R][0],M=(j+2*this.layout.buffer[0])*e*p.default.epsilon,z=this.angle[R];S+=.5*j;var C=_.default.rot([S*e,0],-z),P=_.default.add(this.position,C),N=i(P,M,t,z,this.offset,e),L=N.getExtent();this.obbs.push(N),this.aabbs.push(L),this.offsets[R]=[this.layout.offset[0]+S,this.layout.offset[1]],S+=.5*j+this.space_width}}}},{key:"inTileBounds",value:function(){for(var e=0;e<this.aabbs.length;e++){var t=this.aabbs[e],r={aabb:t},n=p.default.prototype.inTileBounds.call(r);if(!n)return!1}return!0}},{key:"add",value:function(e){this.placed=!0;for(var t=0;t<this.aabbs.length;t++){var r=this.aabbs[t],n=this.obbs[t],i={aabb:r,obb:n};p.default.prototype.add.call(i,e)}}},{key:"discard",value:function(e){var t=arguments.length<=1||void 0===arguments[1]?null:arguments[1];if(this.throw_away)return!0;for(var r=0;r<this.obbs.length;r++){var n=this.aabbs[r],i=this.obbs[r],a={aabb:n,obb:i},o=p.default.prototype.occluded.call(a,e,t);if(o)return!0}return!1}}],[{key:"nextLabel",value:function t(r){var n=r.getNextSegment();if(!n)return!1;var i=l.default(r.layout);i.segment_index=r.segment_index,i.placement=r.placement;var t=new e(r.size,r.lines,i);return t.throw_away?!1:t}}]),e}();r.default=k},{"../utils/obb":355,"../vector":361,"./label":313,"babel-runtime/core-js/object/create":10,"babel-runtime/helpers/classCallCheck":21,"babel-runtime/helpers/createClass":22}],315:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(r,"__esModule",{value:!0});var i=e("babel-runtime/core-js/object/get-prototype-of"),a=n(i),o=e("babel-runtime/helpers/classCallCheck"),s=n(o),l=e("babel-runtime/helpers/createClass"),u=n(l),c=e("babel-runtime/helpers/possibleConstructorReturn"),f=n(c),h=e("babel-runtime/helpers/get"),d=n(h),p=e("babel-runtime/helpers/inherits"),m=n(p),_=e("./label"),g=n(_),v=e("./point_anchor"),y=n(v),b=e("../geo"),x=n(b),w=e("../utils/obb"),k=n(w),A=e("../styles/style_parser"),T=function(e){function t(e,r,n){s.default(this,t);var i=f.default(this,a.default(t).call(this,r,n));i.position=[e[0],e[1]],i.parent=i.layout.parent,i.update(),i.layout.anchor&&(i.start_anchor_index=1);var o=i.getNextFit();return i.throw_away=!o,i}return m.default(t,e),u.default(t,[{key:"update",value:function(){d.default(a.default(t.prototype),"update",this).call(this),this.computeOffset(),this.updateBBoxes()}},{key:"computeOffset",value:function(){if(this.offset=[this.layout.offset[0],this.layout.offset[1]],this.parent){var e=this.parent;this.offset=y.default.computeOffset(this.offset,e.size,e.anchor,y.default.zero_buffer),this.offset=y.default.computeOffset(this.offset,e.size,this.anchor,y.default.zero_buffer),e.offset!==A.StyleParser.zeroPair&&(this.offset===A.StyleParser.zeroPair?this.offset=e.offset:(this.offset[0]+=e.offset[0],this.offset[1]+=e.offset[1]))}this.offset=y.default.computeOffset(this.offset,this.size,this.anchor)}},{key:"updateBBoxes",value:function(){var e=(this.size[0]+2*this.layout.buffer[0])*this.layout.units_per_pixel*g.default.epsilon,t=(this.size[1]+2*this.layout.buffer[1])*this.layout.units_per_pixel*g.default.epsilon,r=[this.position[0]+this.offset[0]*this.layout.units_per_pixel,this.position[1]-this.offset[1]*this.layout.units_per_pixel];this.obb=new k.default(r[0],r[1],0,e,t),this.aabb=this.obb.getExtent()}},{key:"moveIntoTile",value:function(){var e=!1;return this.aabb[0]<0&&(this.position[0]+=-this.aabb[0],e=!0),this.aabb[2]>=x.default.tile_scale&&(this.position[0]-=this.aabb[2]-x.default.tile_scale+1,e=!0),this.aabb[3]>0&&(this.position[1]-=this.aabb[3],e=!0),this.aabb[1]<=-x.default.tile_scale&&(this.position[1]-=this.aabb[1]+x.default.tile_scale-1,e=!0),e&&this.updateBBoxes(),e}},{key:"getNextFit",value:function(){if(!this.layout.cull_from_tile||this.inTileBounds())return!0;if(this.layout.move_into_tile)return this.moveIntoTile(),!0;if(Array.isArray(this.layout.anchor))for(var e=1;e<this.layout.anchor.length;e++)if(this.anchor=this.layout.anchor[e],this.update(),this.start_anchor_index=e,this.inTileBounds())return!0;return!1}},{key:"discard",value:function(e){var r=arguments.length<=1||void 0===arguments[1]?null:arguments[1];if(d.default(a.default(t.prototype),"discard",this).call(this,e,r)){if(Array.isArray(this.layout.anchor))for(var n=this.start_anchor_index;n<this.layout.anchor.length;n++)if(this.anchor=this.layout.anchor[n],this.update(),(!this.layout.cull_from_tile||this.inTileBounds())&&!d.default(a.default(t.prototype),"discard",this).call(this,e,r))return!1;return!0}return!1}}]),t}(g.default);r.default=T},{"../geo":299,"../styles/style_parser":340,"../utils/obb":355,"./label":313,"./point_anchor":316,"babel-runtime/core-js/object/get-prototype-of":14,"babel-runtime/helpers/classCallCheck":21,"babel-runtime/helpers/createClass":22,"babel-runtime/helpers/get":24,"babel-runtime/helpers/inherits":25,"babel-runtime/helpers/possibleConstructorReturn":26}],316:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=["left","top-left","bottom-left"],i=["right","top-right","bottom-right"],a=["top","top-left","top-right"],o=["bottom","bottom-left","bottom-right"],s=void 0;r.default=s={computeOffset:function(e,t,r){var n=arguments.length<=3||void 0===arguments[3]?null:arguments[3];if(!r||"center"===r)return e;var i=[e[0],e[1]];return n=n||this.default_buffer,this.isLeftAnchor(r)?(i[0]-=t[0]/2,"left"===r&&(i[0]-=n[0])):this.isRightAnchor(r)&&(i[0]+=t[0]/2,"right"===r&&(i[0]+=n[1])),this.isTopAnchor(r)?(i[1]-=t[1]/2,"top"===r&&(i[1]-=n[2])):this.isBottomAnchor(r)&&(i[1]+=t[1]/2,"bottom"===r&&(i[1]+=n[3])),i},alignForAnchor:function(e){if(e&&"center"!==e){if(this.isLeftAnchor(e))return"right";if(this.isRightAnchor(e))return"left"}return"center"},isLeftAnchor:function(e){return n.indexOf(e)>-1},isRightAnchor:function(e){return i.indexOf(e)>-1},isTopAnchor:function(e){return a.indexOf(e)>-1},isBottomAnchor:function(e){return o.indexOf(e)>-1},default_buffer:[2.5,2.5,1.5,.75],zero_buffer:[0,0,0,0]}},{}],317:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(r,"__esModule",{value:!0});var i=e("babel-runtime/helpers/classCallCheck"),a=n(i),o=e("babel-runtime/helpers/createClass"),s=n(o),l=e("../geo"),u=n(l),c=function(){function e(t,r,n){a.default(this,e),this.key=t,this.repeat_dist=r,this.repeat_dist_sq=this.repeat_dist*this.repeat_dist,this.max_repeat_dist_sq=n*n,this.one_per_group=this.repeat_dist_sq>=this.max_repeat_dist_sq?!0:!1,this.positions=[]}return s.default(e,[{key:"check",value:function(e){if(this.one_per_group){if(this.positions.length>0)return{dist_sq:this.max_repeat_dist_sq,repeat_dist_sq:this.repeat_dist_sq,one_per_group:this.one_per_group}}else for(var t=e.position,r=0;r<this.positions.length;r++){var n=this.positions[r],i=t[0]-n[0],a=t[1]-n[1],o=i*i+a*a;if(o<this.repeat_dist_sq)return{dist_sq:o,repeat_dist_sq:this.repeat_dist_sq}}}},{key:"add",value:function(e){e&&e.position&&this.positions.push(e.position)}}],[{key:"clear",value:function(e){this.groups[e]={}}},{key:"check",value:function(e,t,r){return t.repeat_distance&&t.repeat_group&&this.groups[r][t.repeat_group]?this.groups[r][t.repeat_group].check(e):void 0}},{key:"add",value:function(t,r,n){r.repeat_distance&&r.repeat_group&&(null==this.groups[n][r.repeat_group]&&(this.groups[n][r.repeat_group]=new e(r.repeat_group,r.repeat_distance,e.max_repeat_dist)),this.groups[n][r.repeat_group].add(t))}}]),e}();r.default=c,c.groups={},c.max_repeat_dist=u.default.tile_scale},{"../geo":299,"babel-runtime/helpers/classCallCheck":21,"babel-runtime/helpers/createClass":22}],318:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function i(e){return a(e)}function a(e){if("undefined"!=typeof v)return new v(e);if(f.default.is_main){var t=function(){var t=e.leaflet||window.L,n=t.GridLayer?t.GridLayer:t.TileLayer,i=n===t.GridLayer?"1.x":"0.7.x",a={};return n===t.TileLayer&&(a._addTile=function(){},a._removeTile=function(){},a._reset=function(){n.prototype._reset.apply(this,arguments),this.scene&&this.scene.container&&this.scene.canvas&&this.scene.container.appendChild(this.scene.canvas)}),u.default(a,{initialize:function(e){var r=this;e.showDebug=e.showDebug?!0:!1,e.wheelDebounceTime=e.wheelDebounceTime||40,t.setOptions(this,e),this.createScene(),this.hooks={},this._updating_tangram=!1,this._zoomAnimated=!1,this.debounceViewReset=d.default.debounce(function(){r._map.fire("zoomend"),r._map.fire("moveend")},this.options.wheelDebounceTime)},createScene:function(){this.scene=m.default.create(this.options.scene,{numWorkers:this.options.numWorkers,preUpdate:this.options.preUpdate,postUpdate:this.options.postUpdate,continuousZoom:"1.x"===v.leafletVersion,highDensityDisplay:this.options.highDensityDisplay,logLevel:this.options.logLevel,introspection:this.options.introspection,disableRenderLoop:this.options.disableRenderLoop,allowCrossDomainWorkers:this.options.allowCrossDomainWorkers})},onAdd:function(e){var t=this;this.scene||this.createScene(),n.prototype.onAdd.apply(this,arguments),this.hooks.resize=function(){t._updating_tangram=!0,t.updateSize(),t._updating_tangram=!1},e.on("resize",this.hooks.resize),this.hooks.move=function(){if(!t._updating_tangram){t._updating_tangram=!0;var r=e.getCenter();r.zoom=Math.min(e.getZoom(),e.getMaxZoom()||g.default.default_view_max_zoom),t.scene.view.setView(r),t.scene.immediateRedraw(),t.reverseTransform(),t._updating_tangram=!1}},e.on("move",this.hooks.move),this.hooks.zoomstart=function(){t._updating_tangram||(t._updating_tangram=!0,t.scene.view.startZoom(),t._updating_tangram=!1)},e.on("zoomstart",this.hooks.zoomstart),this.hooks.dragstart=function(){t.scene.view.panning=!0},e.on("dragstart",this.hooks.dragstart),this.hooks.dragend=function(){t.scene.view.panning=!1},e.on("dragend",this.hooks.dragend),e._zoomAnimated=!1,this.modifyScrollWheelBehavior(e),this.setupSelectionEventHandlers(e),this.setSelectionEvents(this.options.events),this.scene.container=this.getContainer(),this.updateSize(),this.updateView(),this.scene.subscribe({move:this.onTangramViewUpdate.bind(this)}),this.scene.load().then(function(){t._updating_tangram=!0,t.updateSize(),t.updateView(),t.reverseTransform(),t._updating_tangram=!1,t.fire("init")}).catch(function(e){t.fire("error",e)})},onRemove:function(e){n.prototype.onRemove.apply(this,arguments),e.off("resize",this.hooks.resize),e.off("move",this.hooks.move),e.off("zoomstart",this.hooks.zoomstart),e.off("dragstart",this.hooks.dragstart),e.off("dragend",this.hooks.dragend),e.off("click",this.hooks.click),e.off("mousemove",this.hooks.mousemove),e.off("mouseout",this.hooks.mouseout),this.hooks={},this.scene&&(this.scene.destroy(),this.scene=null)},createTile:function(e){var t=e.x+"/"+e.y+"/"+e.z,r=document.createElement("div");if(r.setAttribute("data-tile-key",t),r.style.width="256px",r.style.height="256px",this.options.showDebug){var n=document.createElement("div");n.textContent=t,n.style.position="absolute",n.style.left=0,n.style.top=0,n.style.color="white",n.style.fontSize="16px",n.style.textOutline="1px #000000",n.style.padding="8px",r.appendChild(n),r.style.borderStyle="solid",r.style.borderColor="white",r.style.borderWidth="1px"}return r},modifyScrollWheelBehavior:function(e){this.scene.view.continuous_zoom&&e.scrollWheelZoom&&this.options.modifyScrollWheel!==!1&&(e.options.zoomSnap=0,e.options.wheelPxPerZoomLevel=1e3,e.options.wheelDebounceTime=10)},updateView:function(){var e=this._map.getCenter();e.zoom=Math.min(this._map.getZoom(),this._map.getMaxZoom()||g.default.default_view_max_zoom),this.scene.view.setView(e)},updateSize:function(){var e=this._map.getSize();this.scene.resizeMap(e.x,e.y)},onTangramViewUpdate:function(){this._map&&!this._updating_tangram&&(this._updating_tangram=!0,this._map.setView([this.scene.view.center.lat,this.scene.view.center.lng],this.scene.view.zoom,{animate:!1}),this.reverseTransform(),this._updating_tangram=!1)},render:function(){this.scene&&this.scene.update()},reverseTransform:function(){if(this._map&&this.scene&&this.scene.container){var e=this._map.containerPointToLayerPoint([0,0]);t.DomUtil.setPosition(this.scene.container,e)}},setupSelectionEventHandlers:function(e){var t=this;this._selection_events={},this.hooks.click=function(e){"function"==typeof t._selection_events.click&&t.scene.getFeatureAt(e.containerPoint).then(function(r){var n=u.default({},r,{leaflet_event:e});t._selection_events.click(n)})},e.on("click",this.hooks.click),this.hooks.mousemove=function(e){"function"==typeof t._selection_events.hover&&t.scene.getFeatureAt(e.containerPoint).then(function(r){var n=u.default({},r,{leaflet_event:e});t._selection_events.hover(n)})},e.on("mousemove",this.hooks.mousemove),this.hooks.mouseout=function(e){"function"==typeof t._selection_events.hover&&t._selection_events.hover({changed:!0,leaflet_event:e})},e.on("mouseout",this.hooks.mouseout)},setSelectionEvents:function(e){this._selection_events=u.default(this._selection_events,e)}}),r.LeafletLayer=v=n.extend(a),"function"!=typeof v.remove&&(v.prototype.remove=function(){this._map&&this._map.removeLayer(this),this.fire("remove")}),v.layerBaseClass=n,v.leafletVersion=i,{v:new v(e)}}();if("object"===("undefined"==typeof t?"undefined":s.default(t)))return t.v}}Object.defineProperty(r,"__esModule",{value:!0}),r.LeafletLayer=void 0;var o=e("babel-runtime/helpers/typeof"),s=n(o),l=e("babel-runtime/core-js/object/assign"),u=n(l);r.leafletLayer=i;var c=e("./utils/thread"),f=n(c),h=e("./utils/utils"),d=n(h),p=e("./scene"),m=n(p),_=e("./geo"),g=n(_),v=r.LeafletLayer=void 0},{"./geo":299,"./scene":322,"./utils/thread":357,"./utils/utils":358,"babel-runtime/core-js/object/assign":9,"babel-runtime/helpers/typeof":29}],319:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(r,"__esModule",{value:!0});var i=e("babel-runtime/helpers/slicedToArray"),a=n(i),o=e("babel-runtime/helpers/get"),s=n(o),l=e("babel-runtime/core-js/object/get-prototype-of"),u=n(l),c=e("babel-runtime/helpers/possibleConstructorReturn"),f=n(c),h=e("babel-runtime/helpers/inherits"),d=n(h),p=e("babel-runtime/core-js/object/keys"),m=n(p),_=e("babel-runtime/helpers/classCallCheck"),g=n(_),v=e("babel-runtime/helpers/createClass"),y=n(v),b=e("./gl/shader_program"),x=n(b),w=e("./gl/glsl"),k=n(w),A=e("./geo"),T=n(A),E=e("./vector"),S=n(E),R=e("./styles/style_parser"),j="/*\n\nExpected globals:\nlight_accumulator_*\n\n*/\n\nstruct AmbientLight {\n vec3 ambient;\n};\n\nvoid calculateLight(in AmbientLight _light, in vec3 _eyeToPoint, in vec3 _normal) {\n light_accumulator_ambient.rgb += _light.ambient;\n}\n",M="/*\n\nExpected globals:\nmaterial\nlight_accumulator_*\n\n*/\n\nstruct DirectionalLight {\n vec3 ambient;\n vec3 diffuse;\n vec3 specular;\n vec3 direction;\n};\n\nvoid calculateLight(in DirectionalLight _light, in vec3 _eyeToPoint, in vec3 _normal) {\n\n light_accumulator_ambient.rgb += _light.ambient;\n\n float nDotVP = clamp(dot(_normal, -_light.direction), 0.0, 1.0);\n\n #ifdef TANGRAM_MATERIAL_DIFFUSE\n light_accumulator_diffuse.rgb += _light.diffuse * nDotVP;\n #endif\n\n #ifdef TANGRAM_MATERIAL_SPECULAR\n float pf = 0.0;\n if (nDotVP > 0.0) {\n vec3 reflectVector = reflect(_light.direction, _normal);\n float eyeDotR = max(dot(normalize(_eyeToPoint), reflectVector), 0.0);\n pf = pow(eyeDotR, material.shininess);\n }\n light_accumulator_specular.rgb += _light.specular * pf;\n #endif\n}\n",z="/*\n\nExpected globals:\nmaterial\nlight_accumulator_*\n\n*/\n\nstruct PointLight {\n vec3 ambient;\n vec3 diffuse;\n vec3 specular;\n vec4 position;\n\n#ifdef TANGRAM_POINTLIGHT_ATTENUATION_EXPONENT\n float attenuationExponent;\n#endif\n\n#ifdef TANGRAM_POINTLIGHT_ATTENUATION_INNER_RADIUS\n float innerRadius;\n#endif\n\n#ifdef TANGRAM_POINTLIGHT_ATTENUATION_OUTER_RADIUS\n float outerRadius;\n#endif\n};\n\nvoid calculateLight(in PointLight _light, in vec3 _eyeToPoint, in vec3 _normal) {\n\n float dist = length(_light.position.xyz - _eyeToPoint);\n\n // Compute vector from surface to light position\n vec3 VP = (_light.position.xyz - _eyeToPoint) / dist;\n\n // Normalize the vector from surface to light position\n float nDotVP = clamp(dot(VP, _normal), 0.0, 1.0);\n\n // Attenuation defaults\n float attenuation = 1.0;\n #ifdef TANGRAM_POINTLIGHT_ATTENUATION_EXPONENT\n float Rin = 1.0;\n float e = _light.attenuationExponent;\n\n #ifdef TANGRAM_POINTLIGHT_ATTENUATION_INNER_RADIUS\n Rin = _light.innerRadius;\n #endif\n\n #ifdef TANGRAM_POINTLIGHT_ATTENUATION_OUTER_RADIUS\n float Rdiff = _light.outerRadius-Rin;\n float d = clamp(max(0.0,dist-Rin)/Rdiff, 0.0, 1.0);\n attenuation = 1.0-(pow(d,e));\n #else\n // If no outer is provide behaves like:\n // https://imdoingitwrong.wordpress.com/2011/01/31/light-attenuation/\n float d = max(0.0,dist-Rin)/Rin+1.0;\n attenuation = clamp(1.0/(pow(d,e)), 0.0, 1.0);\n #endif\n #else\n float Rin = 0.0;\n\n #ifdef TANGRAM_POINTLIGHT_ATTENUATION_INNER_RADIUS\n Rin = _light.innerRadius;\n #ifdef TANGRAM_POINTLIGHT_ATTENUATION_OUTER_RADIUS\n float Rdiff = _light.outerRadius-Rin;\n float d = clamp(max(0.0,dist-Rin)/Rdiff, 0.0, 1.0);\n attenuation = 1.0-d*d;\n #else\n // If no outer is provide behaves like:\n // https://imdoingitwrong.wordpress.com/2011/01/31/light-attenuation/\n float d = max(0.0,dist-Rin)/Rin+1.0;\n attenuation = clamp(1.0/d, 0.0, 1.0);\n #endif\n #else\n #ifdef TANGRAM_POINTLIGHT_ATTENUATION_OUTER_RADIUS\n float d = clamp(dist/_light.outerRadius, 0.0, 1.0);\n attenuation = 1.0-d*d;\n #else\n attenuation = 1.0;\n #endif\n #endif\n #endif\n\n // Computer accumulators\n light_accumulator_ambient.rgb += _light.ambient * attenuation;\n\n #ifdef TANGRAM_MATERIAL_DIFFUSE\n light_accumulator_diffuse.rgb += _light.diffuse * nDotVP * attenuation;\n #endif\n\n #ifdef TANGRAM_MATERIAL_SPECULAR\n float pf = 0.0; // power factor for shiny speculars\n if (nDotVP > 0.0) {\n vec3 reflectVector = reflect(-VP, _normal);\n float eyeDotR = max(0.0, dot(-normalize(_eyeToPoint), reflectVector));\n pf = pow(eyeDotR, material.shininess);\n }\n\n light_accumulator_specular.rgb += _light.specular * pf * attenuation;\n #endif\n}\n",C="/*\n\nExpected globals:\nmaterial\nlight_accumulator_*\n\n*/\n\nstruct SpotLight {\n vec3 ambient;\n vec3 diffuse;\n vec3 specular;\n vec4 position;\n\n#ifdef TANGRAM_POINTLIGHT_ATTENUATION_EXPONENT\n float attenuationExponent;\n#endif\n\n#ifdef TANGRAM_POINTLIGHT_ATTENUATION_INNER_RADIUS\n float innerRadius;\n#endif\n\n#ifdef TANGRAM_POINTLIGHT_ATTENUATION_OUTER_RADIUS\n float outerRadius;\n#endif\n\n vec3 direction;\n float spotCosCutoff;\n float spotExponent;\n};\n\nvoid calculateLight(in SpotLight _light, in vec3 _eyeToPoint, in vec3 _normal) {\n\n float dist = length(_light.position.xyz - _eyeToPoint);\n\n // Compute vector from surface to light position\n vec3 VP = (_light.position.xyz - _eyeToPoint) / dist;\n\n // normal . light direction\n float nDotVP = clamp(dot(_normal, VP), 0.0, 1.0);\n\n // Attenuation defaults\n float attenuation = 1.0;\n #ifdef TANGRAM_POINTLIGHT_ATTENUATION_EXPONENT\n float Rin = 1.0;\n float e = _light.attenuationExponent;\n\n #ifdef TANGRAM_POINTLIGHT_ATTENUATION_INNER_RADIUS\n Rin = _light.innerRadius;\n #endif\n\n #ifdef TANGRAM_POINTLIGHT_ATTENUATION_OUTER_RADIUS\n float Rdiff = _light.outerRadius-Rin;\n float d = clamp(max(0.0,dist-Rin)/Rdiff, 0.0, 1.0);\n attenuation = 1.0-(pow(d,e));\n #else\n // If no outer is provide behaves like:\n // https://imdoingitwrong.wordpress.com/2011/01/31/light-attenuation/\n float d = max(0.0,dist-Rin)/Rin+1.0;\n attenuation = clamp(1.0/(pow(d,e)), 0.0, 1.0);\n #endif\n #else\n float Rin = 0.0;\n\n #ifdef TANGRAM_POINTLIGHT_ATTENUATION_INNER_RADIUS\n Rin = _light.innerRadius;\n #ifdef TANGRAM_POINTLIGHT_ATTENUATION_OUTER_RADIUS\n float Rdiff = _light.outerRadius-Rin;\n float d = clamp(max(0.0,dist-Rin)/Rdiff, 0.0, 1.0);\n attenuation = 1.0-d*d;\n #else\n // If no outer is provide behaves like:\n // https://imdoingitwrong.wordpress.com/2011/01/31/light-attenuation/\n float d = max(0.0,dist-Rin)/Rin+1.0;\n attenuation = clamp(1.0/d, 0.0, 1.0);\n #endif\n #else\n #ifdef TANGRAM_POINTLIGHT_ATTENUATION_OUTER_RADIUS\n float d = clamp(dist/_light.outerRadius, 0.0, 1.0);\n attenuation = 1.0-d*d;\n #else\n attenuation = 1.0;\n #endif\n #endif\n #endif\n\n // spotlight attenuation factor\n float spotAttenuation = 0.0;\n\n // See if point on surface is inside cone of illumination\n float spotDot = clamp(dot(-VP, _light.direction), 0.0, 1.0);\n\n if (spotDot >= _light.spotCosCutoff) {\n spotAttenuation = pow(spotDot, _light.spotExponent);\n }\n\n light_accumulator_ambient.rgb += _light.ambient * attenuation * spotAttenuation;\n\n #ifdef TANGRAM_MATERIAL_DIFFUSE\n light_accumulator_diffuse.rgb += _light.diffuse * nDotVP * attenuation * spotAttenuation;\n #endif\n\n #ifdef TANGRAM_MATERIAL_SPECULAR\n // Power factor for shiny speculars\n float pf = 0.0;\n if (nDotVP > 0.0) {\n vec3 reflectVector = reflect(-VP, _normal);\n float eyeDotR = max(dot(-normalize(_eyeToPoint), reflectVector), 0.0);\n pf = pow(eyeDotR, material.shininess);\n }\n light_accumulator_specular.rgb += _light.specular * pf * attenuation * spotAttenuation;\n #endif\n}\n",P=function(){function e(t,r){g.default(this,e),this.name=r.name,this.view=t,this.ambient=null==r.ambient||"number"==typeof r.ambient?k.default.expandVec3(r.ambient||0):R.StyleParser.parseColor(r.ambient).slice(0,3),this.diffuse=null==r.diffuse||"number"==typeof r.diffuse?k.default.expandVec3(null!=r.diffuse?r.diffuse:1):R.StyleParser.parseColor(r.diffuse).slice(0,3),this.specular=null==r.specular||"number"==typeof r.specular?k.default.expandVec3(r.specular||0):R.StyleParser.parseColor(r.specular).slice(0,3) 13 }return y.default(e,[{key:"inject",value:function(){var t="\n uniform "+this.struct_name+" u_"+this.name+";\n "+this.struct_name+" "+this.name+";\n ",r="\n "+this.name+" = u_"+this.name+";\n\n ";x.default.addBlock(e.block,t),x.default.addBlock("setup",r)}},{key:"update",value:function(){}},{key:"setupProgram",value:function(e){e.uniform("3fv","u_"+this.name+".ambient",this.ambient),e.uniform("3fv","u_"+this.name+".diffuse",this.diffuse),e.uniform("3fv","u_"+this.name+".specular",this.specular)}}],[{key:"create",value:function(t,r){return e.types[r.type]?new e.types[r.type](t,r):void 0}},{key:"setMode",value:function(t,r){t===!0&&(t="fragment"),t=e.enabled&&(null!=t?t:"fragment"),r.defines.TANGRAM_LIGHTING_FRAGMENT="fragment"===t,r.defines.TANGRAM_LIGHTING_VERTEX="vertex"===t}},{key:"inject",value:function(t){if(x.default.removeBlock(e.block),e.enabled){var r="";if(t&&m.default(t).length>0){var n={};for(var i in t)n[t[i].type]=!0;for(var a in n)e.types[a].inject();for(var o in t)t[o].inject(),r+="calculateLight("+o+", _eyeToPoint, _normal);\n"}var s="\n vec4 calculateLighting(in vec3 _eyeToPoint, in vec3 _normal, in vec4 _color) {\n\n // Do initial material calculations over normal, emission, ambient, diffuse and specular values\n calculateMaterial(_eyeToPoint,_normal);\n\n // Un roll the loop of individual ligths to calculate\n "+r+"\n\n // Final light intensity calculation\n vec4 color = vec4(0.0);\n\n // Keep material alpha channel when alpha blending is on\n #if !defined(TANGRAM_BLEND_OPAQUE)\n #ifdef TANGRAM_MATERIAL_EMISSION\n color = material.emission;\n #endif\n\n #ifdef TANGRAM_MATERIAL_AMBIENT\n color += light_accumulator_ambient * _color * material.ambient;\n #else\n #ifdef TANGRAM_MATERIAL_DIFFUSE\n color += light_accumulator_ambient * _color * material.diffuse;\n #endif\n #endif\n\n #ifdef TANGRAM_MATERIAL_DIFFUSE\n color += light_accumulator_diffuse * _color * material.diffuse;\n #endif\n\n #ifdef TANGRAM_MATERIAL_SPECULAR\n color += light_accumulator_specular * material.specular;\n #endif\n // Multiply material alpha channel into material RGB when alpha blending is off\n #else\n color.a = _color.a; // use vertex color alpha\n\n #ifdef TANGRAM_MATERIAL_EMISSION\n color.rgb = material.emission.rgb * material.emission.a;\n #endif\n\n #ifdef TANGRAM_MATERIAL_AMBIENT\n color.rgb += light_accumulator_ambient.rgb * _color.rgb * material.ambient.rgb * material.ambient.a;\n #else\n #ifdef TANGRAM_MATERIAL_DIFFUSE\n color.rgb += light_accumulator_ambient.rgb * _color.rgb * material.diffuse.rgb * material.diffuse.a;\n #endif\n #endif\n\n #ifdef TANGRAM_MATERIAL_DIFFUSE\n color.rgb += light_accumulator_diffuse.rgb * _color.rgb * material.diffuse.rgb * material.diffuse.a;\n #endif\n\n #ifdef TANGRAM_MATERIAL_SPECULAR\n color.rgb += light_accumulator_specular.rgb * material.specular.rgb * material.specular.a;\n #endif\n #endif\n\n // Clamp final color\n color = clamp(color, 0.0, 1.0);\n\n return color;\n }";x.default.addBlock(e.block,s)}}}]),e}();r.default=P,P.types={},P.block="lighting",P.enabled=!0;var N=function(e){function t(e,r){g.default(this,t);var n=f.default(this,u.default(t).call(this,e,r));return n.type="ambient",n.struct_name="AmbientLight",n}return d.default(t,e),y.default(t,[{key:"setupProgram",value:function(e){e.uniform("3fv","u_"+this.name+".ambient",this.ambient)}}],[{key:"inject",value:function(){x.default.addBlock(P.block,j)}}]),t}(P);P.types.ambient=N;var L=function(e){function t(e,r){g.default(this,t);var n=f.default(this,u.default(t).call(this,e,r));if(n.type="directional",n.struct_name="DirectionalLight",r.direction)n._direction=r.direction;else{var i=135,a=Math.sin(60*Math.PI/180);n._direction=[Math.cos(Math.PI*i/180)*a,Math.sin(Math.PI*i/180)*a,-.5],null==r.ambient&&(n.ambient=k.default.expandVec3(.5))}return n.direction=n._direction.map(parseFloat),n}return d.default(t,e),y.default(t,[{key:"setupProgram",value:function(e){s.default(u.default(t.prototype),"setupProgram",this).call(this,e),e.uniform("3fv","u_"+this.name+".direction",this.direction)}},{key:"direction",get:function(){return this._direction},set:function(e){this._direction=S.default.normalize(e)}}],[{key:"inject",value:function(){x.default.addBlock(P.block,M)}}]),t}(P);P.types.directional=L;var O=function(e){function t(e,r){g.default(this,t);var n=f.default(this,u.default(t).call(this,e,r));return n.type="point",n.struct_name="PointLight",n.position=r.position||[0,0,"100px"],n.position_eye=[],n.origin=r.origin||"ground",n.attenuation=isNaN(parseFloat(r.attenuation))?0:parseFloat(r.attenuation),n.radius=r.radius?Array.isArray(r.radius)&&2===r.radius.length?r.radius:[null,r.radius]:null,n}return d.default(t,e),y.default(t,[{key:"inject",value:function(){s.default(u.default(t.prototype),"inject",this).call(this),x.default.defines.TANGRAM_POINTLIGHT_ATTENUATION_EXPONENT=0!==this.attenuation,x.default.defines.TANGRAM_POINTLIGHT_ATTENUATION_INNER_RADIUS=null!=this.radius&&null!=this.radius[0],x.default.defines.TANGRAM_POINTLIGHT_ATTENUATION_OUTER_RADIUS=null!=this.radius}},{key:"update",value:function(){this.updateEyePosition()}},{key:"updateEyePosition",value:function(){if("world"===this.origin){var e=T.default.latLngToMeters(this.position),t=a.default(e,2),r=t[0],n=t[1];this.position_eye[0]=r-this.view.camera.position_meters[0],this.position_eye[1]=n-this.view.camera.position_meters[1],this.position_eye[2]=R.StyleParser.convertUnits(this.position[2],{zoom:this.view.zoom,meters_per_pixel:T.default.metersPerPixel(this.view.zoom)}),this.position_eye[2]=this.position_eye[2]-this.view.camera.position_meters[2]}else("ground"===this.origin||"camera"===this.origin)&&(this.position_eye=R.StyleParser.convertUnits(this.position,{zoom:this.view.zoom,meters_per_pixel:T.default.metersPerPixel(this.view.zoom)}),"ground"===this.origin&&(this.position_eye[2]=this.position_eye[2]-this.view.camera.position_meters[2]));this.position_eye[3]=1}},{key:"setupProgram",value:function(e){s.default(u.default(t.prototype),"setupProgram",this).call(this,e),e.uniform("4fv","u_"+this.name+".position",this.position_eye),x.default.defines.TANGRAM_POINTLIGHT_ATTENUATION_EXPONENT&&e.uniform("1f","u_"+this.name+".attenuationExponent",this.attenuation),x.default.defines.TANGRAM_POINTLIGHT_ATTENUATION_INNER_RADIUS&&e.uniform("1f","u_"+this.name+".innerRadius",R.StyleParser.convertUnits(this.radius[0],{zoom:this.view.zoom,meters_per_pixel:T.default.metersPerPixel(this.view.zoom)})),x.default.defines.TANGRAM_POINTLIGHT_ATTENUATION_OUTER_RADIUS&&e.uniform("1f","u_"+this.name+".outerRadius",R.StyleParser.convertUnits(this.radius[1],{zoom:this.view.zoom,meters_per_pixel:T.default.metersPerPixel(this.view.zoom)}))}}],[{key:"inject",value:function(){x.default.addBlock(P.block,z)}}]),t}(P);P.types.point=O;var I=function(e){function t(e,r){g.default(this,t);var n=f.default(this,u.default(t).call(this,e,r));return n.type="spotlight",n.struct_name="SpotLight",n.direction=n._direction=(r.direction||[0,0,-1]).map(parseFloat),n.exponent=r.exponent?parseFloat(r.exponent):.2,n.angle=r.angle?parseFloat(r.angle):20,n}return d.default(t,e),y.default(t,[{key:"setupProgram",value:function(e){s.default(u.default(t.prototype),"setupProgram",this).call(this,e),e.uniform("3fv","u_"+this.name+".direction",this.direction),e.uniform("1f","u_"+this.name+".spotCosCutoff",Math.cos(3.14159*this.angle/180)),e.uniform("1f","u_"+this.name+".spotExponent",this.exponent)}},{key:"direction",get:function(){return this._direction},set:function(e){this._direction=S.default.normalize(e)}}],[{key:"inject",value:function(){x.default.addBlock(P.block,C)}}]),t}(O);P.types.spotlight=I},{"./geo":299,"./gl/glsl":303,"./gl/shader_program":305,"./styles/style_parser":340,"./vector":361,"babel-runtime/core-js/object/get-prototype-of":14,"babel-runtime/core-js/object/keys":15,"babel-runtime/helpers/classCallCheck":21,"babel-runtime/helpers/createClass":22,"babel-runtime/helpers/get":24,"babel-runtime/helpers/inherits":25,"babel-runtime/helpers/possibleConstructorReturn":26,"babel-runtime/helpers/slicedToArray":27}],320:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(r,"__esModule",{value:!0});var i=e("babel-runtime/helpers/classCallCheck"),a=n(i),o=e("babel-runtime/helpers/createClass"),s=n(o),l=e("./gl/glsl"),u=n(l),c=e("./styles/style_parser"),f="/*\n\nDefines globals:\nmaterial\nlight_accumulator_*\n\n*/\n\n\n// MATERIALS\n//\nstruct Material {\n #ifdef TANGRAM_MATERIAL_EMISSION\n vec4 emission;\n #ifdef TANGRAM_MATERIAL_EMISSION_TEXTURE\n vec3 emissionScale;\n #endif\n #endif\n\n #ifdef TANGRAM_MATERIAL_AMBIENT\n vec4 ambient;\n #ifdef TANGRAM_MATERIAL_AMBIENT_TEXTURE\n vec3 ambientScale;\n #endif\n #endif\n\n #ifdef TANGRAM_MATERIAL_DIFFUSE\n vec4 diffuse;\n #ifdef TANGRAM_MATERIAL_DIFFUSE_TEXTURE\n vec3 diffuseScale;\n #endif\n #endif\n\n #ifdef TANGRAM_MATERIAL_SPECULAR\n vec4 specular;\n float shininess;\n #ifdef TANGRAM_MATERIAL_SPECULAR_TEXTURE\n vec3 specularScale;\n #endif\n #endif\n\n\n #ifdef TANGRAM_MATERIAL_NORMAL_TEXTURE\n vec3 normalScale;\n float normalAmount;\n #endif\n};\n\n// Note: uniform is copied to a global instance to allow modification\nuniform Material u_material;\nMaterial material;\n\n#ifdef TANGRAM_MATERIAL_EMISSION_TEXTURE\nuniform sampler2D u_material_emission_texture;\n#endif\n\n#ifdef TANGRAM_MATERIAL_AMBIENT_TEXTURE\nuniform sampler2D u_material_ambient_texture;\n#endif\n\n#ifdef TANGRAM_MATERIAL_DIFFUSE_TEXTURE\nuniform sampler2D u_material_diffuse_texture;\n#endif\n\n#ifdef TANGRAM_MATERIAL_SPECULAR_TEXTURE\nuniform sampler2D u_material_specular_texture;\n#endif\n\n#ifdef TANGRAM_MATERIAL_NORMAL_TEXTURE\nuniform sampler2D u_material_normal_texture;\n#endif\n\n// Global light accumulators for each property\nvec4 light_accumulator_ambient = vec4(vec3(0.0), 1.);\nvec4 light_accumulator_diffuse = vec4(vec3(0.0), 1.);\n#ifdef TANGRAM_MATERIAL_SPECULAR\n vec4 light_accumulator_specular = vec4(vec3(0.0), 1.);\n#endif\n\n\n#ifdef TANGRAM_MATERIAL_TEXTURE_SPHEREMAP\nvec4 getSphereMap (in sampler2D _tex, in vec3 _eyeToPoint, in vec3 _normal, in vec2 _skew) {\n vec3 eye = normalize(_eyeToPoint);\n eye.xy -= _skew;\n eye = normalize(eye);\n\n vec3 r = reflect(eye, _normal);\n r.z += 1.0;\n float m = 2. * length(r);\n vec2 uv = r.xy / m + .5;\n return texture2D(_tex, uv);\n}\n#endif\n\n\n#ifdef TANGRAM_MATERIAL_TEXTURE_TRIPLANAR\nvec3 getTriPlanarBlend (in vec3 _normal) {\n vec3 blending = abs(_normal);\n blending = normalize(max(blending, 0.00001));\n float b = (blending.x + blending.y + blending.z);\n return blending / b;\n}\n\nvec4 getTriPlanar (in sampler2D _tex, in vec3 _pos, in vec3 _normal, in vec3 _scale) {\n vec3 blending = getTriPlanarBlend(_normal);\n vec4 xaxis = texture2D(_tex, fract(_pos.yz * _scale.x));\n vec4 yaxis = texture2D(_tex, fract(_pos.xz * _scale.y));\n vec4 zaxis = texture2D(_tex, fract(_pos.xy * _scale.z));\n return xaxis * blending.x + yaxis * blending.y + zaxis * blending.z;\n}\n#endif\n\n\n#ifdef TANGRAM_MATERIAL_TEXTURE_PLANAR\nvec4 getPlanar (in sampler2D _tex, in vec3 _pos, in vec2 _scale) {\n return texture2D( _tex, fract(_pos.xy * _scale.x) );\n}\n#endif\n\n\n#ifdef TANGRAM_MATERIAL_NORMAL_TEXTURE\nvoid calculateNormal (inout vec3 _normal) {\n // Get NORMALMAP\n //------------------------------------------------\n #ifdef TANGRAM_MATERIAL_NORMAL_TEXTURE_UV\n _normal += texture2D(u_material_normal_texture, fract(v_texcoord*material.normalScale.xy)).rgb*2.0-1.0;\n #endif\n\n #ifdef TANGRAM_MATERIAL_NORMAL_TEXTURE_PLANAR\n vec3 normalTex = getPlanar(u_material_normal_texture, v_world_position.xyz, material.normalScale.xy).rgb*2.0-1.0;\n _normal += normalTex;\n #endif\n\n #ifdef TANGRAM_MATERIAL_NORMAL_TEXTURE_TRIPLANAR\n vec3 normalTex = getTriPlanar(u_material_normal_texture, v_world_position.xyz, _normal, material.normalScale).rgb*2.0-1.0;\n _normal += normalTex;\n #endif\n\n _normal = normalize(_normal);\n}\n#endif\n\nvoid calculateMaterial (in vec3 _eyeToPoint, inout vec3 _normal) {\n // get EMISSION TEXTUREMAP\n //------------------------------------------------\n #ifdef TANGRAM_MATERIAL_EMISSION_TEXTURE\n #ifdef TANGRAM_MATERIAL_EMISSION_TEXTURE_UV\n material.emission *= texture2D(u_material_emission_texture,v_texcoord);\n #endif\n\n #ifdef TANGRAM_MATERIAL_EMISSION_TEXTURE_PLANAR\n material.emission *= getPlanar(u_material_emission_texture, v_world_position.xyz, material.emissionScale.xy);\n #endif\n\n #ifdef TANGRAM_MATERIAL_EMISSION_TEXTURE_TRIPLANAR\n material.emission *= getTriPlanar(u_material_emission_texture, v_world_position.xyz, _normal, material.emissionScale);\n #endif\n\n #ifdef TANGRAM_MATERIAL_EMISSION_TEXTURE_SPHEREMAP\n material.emission *= getSphereMap(u_material_emission_texture, _eyeToPoint, _normal, u_vanishing_point);\n #endif\n #endif\n\n // get AMBIENT TEXTUREMAP\n //------------------------------------------------\n #ifdef TANGRAM_MATERIAL_AMBIENT_TEXTURE\n #ifdef TANGRAM_MATERIAL_AMBIENT_TEXTURE_UV\n material.ambient *= texture2D(u_material_ambient_texture,v_texcoord);\n #endif\n\n #ifdef TANGRAM_MATERIAL_AMBIENT_TEXTURE_PLANAR\n material.ambient *= getPlanar(u_material_ambient_texture, v_world_position.xyz, material.ambientScale.xy);\n #endif\n\n #ifdef TANGRAM_MATERIAL_AMBIENT_TEXTURE_TRIPLANAR\n material.ambient *= getTriPlanar(u_material_ambient_texture, v_world_position.xyz, _normal, material.ambientScale);\n #endif\n\n #ifdef TANGRAM_MATERIAL_AMBIENT_TEXTURE_SPHEREMAP\n material.ambient *= getSphereMap(u_material_ambient_texture, _eyeToPoint, _normal, u_vanishing_point);\n #endif\n #endif\n\n // get DIFFUSE TEXTUREMAP\n //------------------------------------------------\n #ifdef TANGRAM_MATERIAL_DIFFUSE_TEXTURE\n #ifdef TANGRAM_MATERIAL_DIFFUSE_TEXTURE_UV\n material.diffuse *= texture2D(u_material_diffuse_texture,v_texcoord);\n #endif\n\n #ifdef TANGRAM_MATERIAL_DIFFUSE_TEXTURE_PLANAR\n material.diffuse *= getPlanar(u_material_diffuse_texture, v_world_position.xyz, material.diffuseScale.xy);\n #endif\n\n #ifdef TANGRAM_MATERIAL_DIFFUSE_TEXTURE_TRIPLANAR\n material.diffuse *= getTriPlanar(u_material_diffuse_texture, v_world_position.xyz, _normal, material.diffuseScale);\n #endif\n\n #ifdef TANGRAM_MATERIAL_DIFFUSE_TEXTURE_SPHEREMAP\n material.diffuse *= getSphereMap(u_material_diffuse_texture, _eyeToPoint, _normal, u_vanishing_point);\n #endif\n #endif\n\n // get SPECULAR TEXTUREMAP\n //------------------------------------------------\n #ifdef TANGRAM_MATERIAL_SPECULAR_TEXTURE\n #ifdef TANGRAM_MATERIAL_SPECULAR_TEXTURE_UV\n material.specular *= texture2D(u_material_specular_texture,v_texcoord);\n #endif\n\n #ifdef TANGRAM_MATERIAL_SPECULAR_TEXTURE_PLANAR\n material.specular *= getPlanar(u_material_specular_texture, v_world_position.xyz, material.specularScale.xy);\n #endif\n\n #ifdef TANGRAM_MATERIAL_SPECULAR_TEXTURE_TRIPLANAR\n material.specular *= getTriPlanar(u_material_specular_texture, v_world_position.xyz, _normal, material.specularScale);\n #endif\n\n #ifdef TANGRAM_MATERIAL_SPECULAR_TEXTURE_SPHEREMAP\n material.specular *= getSphereMap(u_material_specular_texture, _eyeToPoint, _normal, u_vanishing_point);\n #endif\n #endif\n}\n",h=function(){function e(t){a.default(this,e),t=t||{};for(var r=["emission","ambient","diffuse","specular"],n=0;n<r.length;n++){var i=r[n],o=t[i];null!=o&&(this[i]=o.texture?{texture:o.texture,mapping:o.mapping||"spheremap",scale:u.default.expandVec3(null!=o.scale?o.scale:1),amount:u.default.expandVec4(null!=o.amount?o.amount:1)}:"number"==typeof o||Array.isArray(o)?{amount:u.default.expandVec4(o)}:"string"==typeof o?{amount:c.StyleParser.parseColor(o)}:o)}this.specular&&(this.specular.shininess=t.shininess?parseFloat(t.shininess):.2),null!=t.normal&&(this.normal={texture:t.normal.texture,mapping:t.normal.mapping||"triplanar",scale:u.default.expandVec3(null!=t.normal.scale?t.normal.scale:1),amount:null!=t.normal.amount?t.normal.amount:1})}return s.default(e,[{key:"inject",value:function(t){for(var r=["emission","ambient","diffuse","specular"],n=0;n<r.length;n++){var i=r[n],a="TANGRAM_MATERIAL_"+i.toUpperCase(),o=a+"_TEXTURE";t.defines[a]=null!=this[i],this[i]&&this[i].texture&&(t.defines[o]=!0,t.defines[o+"_"+this[i].mapping.toUpperCase()]=!0,t.defines["TANGRAM_MATERIAL_TEXTURE_"+this[i].mapping.toUpperCase()]=!0,t.texcoords=t.texcoords||"uv"===this[i].mapping)}this.normal&&this.normal.texture&&(t.defines.TANGRAM_MATERIAL_NORMAL_TEXTURE=!0,t.defines["TANGRAM_MATERIAL_NORMAL_TEXTURE_"+this.normal.mapping.toUpperCase()]=!0,t.defines["TANGRAM_MATERIAL_TEXTURE_"+this.normal.mapping.toUpperCase()]=!0,t.texcoords=t.texcoords||"uv"===this.normal.mapping),t.replaceShaderBlock(e.block,f,"Material"),t.addShaderBlock("setup","\nmaterial = u_material;\n","Material")}},{key:"setupProgram",value:function(e){for(var t=["emission","ambient","diffuse","specular"],r=0;r<t.length;r++){var n=t[r];this[n]&&(this[n].texture?(e.setTextureUniform("u_material_"+n+"_texture",this[n].texture),e.uniform("3fv","u_material."+n+"Scale",this[n].scale),e.uniform("4fv","u_material."+n,this[n].amount)):this[n].amount&&e.uniform("4fv","u_material."+n,this[n].amount))}this.specular&&e.uniform("1f","u_material.shininess",this.specular.shininess),this.normal&&this.normal.texture&&(e.setTextureUniform("u_material_normal_texture",this.normal.texture),e.uniform("3fv","u_material.normalScale",this.normal.scale),e.uniform("1f","u_material.normalAmount",this.normal.amount))}}],[{key:"isValid",value:function(e){return null==e?!1:null==e.emission&&null==e.ambient&&null==e.diffuse&&null==e.specular?!1:!0}}]),e}();r.default=h,h.block="material"},{"./gl/glsl":303,"./styles/style_parser":340,"babel-runtime/helpers/classCallCheck":21,"babel-runtime/helpers/createClass":22}],321:[function(e,t){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}var n=e("babel-runtime/core-js/promise"),i=r(n),a=e("./leaflet_layer"),o=e("./scene"),s=r(o),l=e("./scene_worker"),u=e("./utils/version"),c=r(u),f=e("./utils/log"),h=r(f),d=e("./utils/thread"),p=r(d),m=e("./utils/utils"),_=r(m),g=e("./geo"),v=r(g),y=e("./vector"),b=r(y),x=e("./sources/data_source"),w=r(x);e("./sources/geojson"),e("./sources/topojson"),e("./sources/mvt"),e("./sources/raster");var k=e("./gl/glsl"),A=r(k),T=e("./gl/shader_program"),E=r(T),S=e("./gl/vertex_data"),R=r(S),j=e("./gl/texture"),M=r(j),z=e("./material"),C=r(z),P=e("./light"),N=r(P),L=e("./utils/worker_broker"),O=r(L),I=e("./styles/layer"),F=e("./styles/style_manager"),U=e("./styles/style_parser"),D=e("./labels/collision"),B=r(D),G=e("./selection"),V=r(G),W=e("./styles/text/canvas_text"),q=r(W),Z=e("./utils/debug_settings"),H=r(Z),X=e("js-yaml"),Y=r(X),J=e("jszip"),K=r(J),$={log:h.default,yaml:Y.default,Thread:p.default,Utils:_.default,Geo:v.default,Vector:b.default,DataSource:w.default,GLSL:A.default,ShaderProgram:E.default,VertexData:R.default,Texture:M.default,Material:C.default,Light:N.default,Scene:s.default,SceneWorker:l.SceneWorker,WorkerBroker:O.default,layer_cache:I.layer_cache,StyleManager:F.StyleManager,StyleParser:U.StyleParser,Collision:B.default,FeatureSelection:V.default,CanvasText:q.default,debugSettings:H.default};p.default.is_main&&(_.default.requestAnimationFramePolyfill(),void 0===window.Promise&&(window.Promise=i.default,K.default.external.Promise=i.default)),t.exports={leafletLayer:a.leafletLayer,debug:$,version:c.default}},{"./geo":299,"./gl/glsl":303,"./gl/shader_program":305,"./gl/texture":306,"./gl/vertex_data":309,"./labels/collision":312,"./leaflet_layer":318,"./light":319,"./material":320,"./scene":322,"./scene_worker":325,"./selection":326,"./sources/data_source":327,"./sources/geojson":328,"./sources/mvt":329,"./sources/raster":330,"./sources/topojson":331,"./styles/layer":332,"./styles/style_manager":339,"./styles/style_parser":340,"./styles/text/canvas_text":341,"./utils/debug_settings":349,"./utils/log":352,"./utils/thread":357,"./utils/utils":358,"./utils/version":359,"./utils/worker_broker":360,"./vector":361,"babel-runtime/core-js/promise":17,"js-yaml":190,jszip:226}],322:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(r,"__esModule",{value:!0});var i=e("babel-runtime/helpers/slicedToArray"),a=n(i),o=e("babel-runtime/core-js/get-iterator"),s=n(o),l=e("babel-runtime/core-js/json/stringify"),u=n(l),c=e("babel-runtime/core-js/object/assign"),f=n(c),h=e("babel-runtime/core-js/promise"),d=n(h),p=e("babel-runtime/core-js/object/keys"),m=n(p),_=e("babel-runtime/helpers/toConsumableArray"),g=n(_),v=e("babel-runtime/helpers/typeof"),y=n(v),b=e("babel-runtime/helpers/classCallCheck"),x=n(b),w=e("babel-runtime/helpers/createClass"),k=n(w),A=e("./utils/log"),T=n(A),E=e("./utils/utils"),S=n(E),R=e("./utils/worker_broker"),j=n(R),M=e("./utils/subscribe"),z=n(M),C=e("./gl/context"),P=n(C),N=e("./gl/texture"),L=n(N),O=e("./gl/vao"),I=n(O),F=e("./styles/style_manager"),U=e("./styles/style"),D=e("./styles/style_parser"),B=e("./scene_loader"),G=n(B),V=e("./view"),W=n(V),q=e("./light"),Z=n(q),H=e("./tile_manager"),X=n(H),Y=e("./sources/data_source"),J=n(Y),K=e("./selection"),$=n(K),Q=e("./gl/render_state"),et=n(Q),tt=e("./styles/text/font_manager"),rt=n(tt),nt=e("./utils/media_capture"),it=n(nt),at=function(){function e(t,r){x.default(this,e),r=r||{},z.default(this),this.id=e.id++,this.initialized=!1,this.initializing=null,this.sources={},this.view=new W.default(this,r),this.tile_manager=new X.default({scene:this,view:this.view}),this.num_workers=r.numWorkers||2,this.worker_url=r.workerUrl,r.disableVertexArrayObjects===!0&&(I.default.disabled=!0),S.default.use_high_density_display=void 0!==r.highDensityDisplay?r.highDensityDisplay:!0,S.default.updateDevicePixelRatio(),this.config=null,this.config_source=t,this.config_serialized=null,this.last_valid_config_source=null,this.styles=null,this.active_styles={},this.style_manager=new F.StyleManager,this.building=null,this.dirty=!0,this.animated=!1,this.preUpdate=r.preUpdate,this.postUpdate=r.postUpdate,this.render_loop=!r.disableRenderLoop,this.render_loop_active=!1,this.render_loop_stop=!1,this.render_count=0,this.last_render_count=0,this.render_count_changed=!1,this.frame=0,this.media_capture=new it.default,this.selection=null,this.introspection=!1,this.resetTime(),this.container=r.container,this.lights=null,this.background=null,this.createListeners(),this.updating=0,this.generation=e.generation,this.last_complete_generation=e.generation,this.setupDebug(),this.log_level=r.logLevel||"warn",T.default.setLevel(this.log_level)}return k.default(e,[{key:"load",value:function(){var e=this,t=arguments.length<=0||void 0===arguments[0]?null:arguments[0],r=arguments.length<=1||void 0===arguments[1]?null:arguments[1];return this.initializing?this.initializing:(this.updating++,this.initialized=!1,this.createCanvas(),this.initializing=this.loadScene(t,r).then(function(){return e.createWorkers()}).then(function(){e.resetFeatureSelection();var t="object"===y.default(e.config_source)||e.hasSubscribersFor("load");return e.updateConfig({serialize_funcs:t,fade_in:!0})}).then(function(){e.updating--,e.initializing=null,e.initialized=!0,e.last_valid_config_source=e.config_source,e.last_valid_config_path=e.config_path,e.render_loop!==!1&&e.setupRenderLoop(),e.requestRedraw()}).catch(function(t){e.initializing=null,e.updating=0;var r=void 0,n=void 0;if("YAMLException"===t.name?(r="yaml",n="Error parsing scene YAML"):n="Error initializing scene",e.trigger("error",{type:r,message:n,error:t,url:e.config_source}),n="Scene.load() failed to load "+e.config_source+": "+t.message,e.last_valid_config_source)return T.default("warn",n,t),T.default("info","Scene.load() reverting to last valid configuration"),e.load(e.last_valid_config_source,e.last_valid_config_path);throw T.default("error",n,t),t}),this.initializing)}},{key:"reload",value:function(){var e=arguments.length<=0||void 0===arguments[0]?null:arguments[0],t=arguments.length<=1||void 0===arguments[1]?null:arguments[1];return this.load(e,t)}},{key:"destroy",value:function(){if(this.initialized=!1,this.render_loop_stop=!0,this.destroyListeners(),this.canvas&&this.canvas.parentNode&&(this.canvas.parentNode.removeChild(this.canvas),this.canvas=null),this.container=null,this.selection&&this.selection.destroy(),this.gl){L.default.destroy(this.gl),this.style_manager.destroy(this.gl),this.styles={};var e=this.gl.getExtension("WEBGL_lose_context");e&&e.loseContext(),this.gl=null}this.sources={},this.destroyWorkers(),this.tile_manager.destroy(),this.tile_manager=null}},{key:"createCanvas",value:function(){if(!this.canvas){this.container=this.container||document.body,this.canvas=document.createElement("canvas"),this.canvas.style.position="absolute",this.canvas.style.top=0,this.canvas.style.left=0,this.container.style.backgroundColor="transparent",this.container.appendChild(this.canvas);try{this.gl=P.default.getContext(this.canvas,{alpha:!0,premultipliedAlpha:!0,device_pixel_ratio:S.default.device_pixel_ratio})}catch(e){throw new Error("Couldn't create WebGL context. Your browser may not support WebGL, or it's turned off? Visit http://webglreport.com/ for more info.")}this.resizeMap(this.container.clientWidth,this.container.clientHeight),I.default.init(this.gl),this.render_states=new et.default(this.gl),this.media_capture.setCanvas(this.canvas)}}},{key:"getWorkerUrl",value:function(){var e=this.worker_url||S.default.findCurrentURL("tangram.debug.js","tangram.min.js");if(!e)throw new Error("Can't load worker because couldn't find base URL that library was loaded from");var t=[].concat(g.default(this.data_source_scripts));t.push(e);var r="importScripts("+t.map(function(e){return"'"+e+"'"}).join(",")+");";return S.default.createObjectURL(new Blob([r],{type:"application/javascript"}))}},{key:"updateDataSourceScripts",value:function(){var e,t=this,r=[].concat(g.default(this.data_source_scripts||[])),n=m.default(this.config.sources).map(function(e){return t.config.sources[e].scripts}).filter(function(e){return e});return n.length>0&&T.default("debug","loading custom data source scripts in worker:",n),this.data_source_scripts=(e=[]).concat.apply(e,g.default(n)).sort(),!(this.data_source_scripts.length===r.length&&this.data_source_scripts.every(function(e,t){return e===r[t]}))}},{key:"createWorkers",value:function(){return this.updateDataSourceScripts()&&this.destroyWorkers(),this.workers?d.default.resolve():this.makeWorkers(this.getWorkerUrl())}},{key:"makeWorkers",value:function(e){var t=this,r=[];this.workers=[];for(var n=function(){a=new Worker(e),t.workers[i]=a,j.default.addWorker(a),T.default("debug","Scene.makeWorkers: initializing worker "+i);var n=i;r.push(j.default.postMessage(a,"self.init",t.id,i,t.num_workers,t.log_level,S.default.device_pixel_ratio).then(function(e){return T.default("debug","Scene.makeWorkers: initialized worker "+e),e},function(e){return T.default("error","Scene.makeWorkers: failed to initialize worker "+n+":",e),d.default.reject(e)}))},i=0;i<this.num_workers;i++){var a;n()}return this.next_worker=0,d.default.all(r).then(function(){T.default.setWorkers(t.workers);var e=t.gl.getExtension("OES_element_index_uint")?!0:!1;j.default.postMessage(t.workers,"VertexElements.setUint32Flag",e)})}},{key:"destroyWorkers",value:function(){Array.isArray(this.workers)&&(T.default.setWorkers(null),this.workers.forEach(function(e){e.terminate(),j.default.removeWorker(e)}),this.workers=null)}},{key:"nextWorker",value:function(){var e=this.workers[this.next_worker];return this.next_worker=(this.next_worker+1)%this.workers.length,e}},{key:"ready",value:function(){return this.view.ready()&&0!==m.default(this.sources).length?!0:!1}},{key:"updateDevicePixelRatio",value:function(){var e=this;S.default.updateDevicePixelRatio()&&j.default.postMessage(this.workers,"self.updateDevicePixelRatio",S.default.device_pixel_ratio).then(function(){return e.rebuild()}).then(function(){return e.resizeMap(e.view.size.css.width,e.view.size.css.height)})}},{key:"resizeMap",value:function(e,t){(0!==e||0!==t)&&(this.dirty=!0,this.view.setViewportSize(e,t),this.gl&&P.default.resize(this.gl,e,t,S.default.device_pixel_ratio))}},{key:"requestRedraw",value:function(){this.dirty=!0}},{key:"immediateRedraw",value:function(){this.dirty=!0,this.update()}},{key:"renderLoop",value:function(){this.render_loop_active=!0,this.initialized&&this.update(),this.render_loop_stop?(this.render_loop_stop=!1,this.render_loop_active=!1):window.requestAnimationFrame(this.renderLoop.bind(this))}},{key:"setupRenderLoop",value:function(){var e=this;this.render_loop_active||setTimeout(function(){e.renderLoop()},0)}},{key:"update",value:function(){var e=!(this.dirty===!1||this.initialized===!1||this.updating>0||this.ready()===!1);return"function"==typeof this.preUpdate&&this.preUpdate(e),e?(this.dirty=!1,this.updateDevicePixelRatio(),this.render(),this.updateViewComplete(),this.media_capture.completeScreenshot(),"function"==typeof this.postUpdate&&this.postUpdate(e),this.animated===!0&&(this.dirty=!0),this.frame++,T.default("trace","Scene.render()"),!0):!1}},{key:"render",value:function(){var e=this,t=this.gl;if(this.view.update(),m.default(this.active_styles).forEach(function(t){return e.styles[t].update()}),m.default(this.lights).forEach(function(t){return e.lights[t].update()}),this.renderable_tiles=this.tile_manager.getRenderableTiles(),this.renderable_tiles_count=this.renderable_tiles.length,this.render_count=this.renderPass(),this.selection.pendingRequests()){if(this.view.panning||this.view.zooming)return void this.selection.clearPendingRequests();this.selection.bind(),this.renderPass("selection_program",{allow_blend:!1}),this.selection.read(),t.bindFramebuffer(t.FRAMEBUFFER,null),t.viewport(0,0,this.canvas.width,this.canvas.height)}return this.render_count_changed=!1,this.render_count!==this.last_render_count&&(this.render_count_changed=!0,this.getFeatureSelectionMapSize().then(function(t){t&&T.default("info","Scene: rendered "+e.render_count+" primitives ("+t+" features in selection map)")})),this.last_render_count=this.render_count,!0}},{key:"renderPass",value:function(){var e=this,t=arguments.length<=0||void 0===arguments[0]?"program":arguments[0],r=arguments.length<=1||void 0===arguments[1]?{}:arguments[1],n=r.allow_blend;n=null==n?!0:n,this.clearFrame({clear_color:!0,clear_depth:!0});for(var i=m.default(this.active_styles).map(function(t){return e.styles[t] 14 }).sort(U.Style.blendOrderSort),a=0,o=void 0,s=0;s<i.length;s++){var l=i[s];if(l.blend!==o){var u=f.default({},U.Style.render_states[l.blend],{blend:n&&l.blend});this.setRenderState(u)}a+=this.renderStyle(l.name,t),o=l.blend}return a}},{key:"renderStyle",value:function(e,t){var r=!0,n=0,i=this.styles[e][t];if(!i||!i.compiled)return 0;for(var a=0;a<this.renderable_tiles.length;a++){var o=this.renderable_tiles[a];if(null!=o.meshes[e]){if(r===!0){r=!1,i.use(),this.styles[e].setup(),i.uniform("1f","u_time",this.animated?(+new Date-this.start_time)/1e3:0),this.view.setupProgram(i);for(var s in this.lights)this.lights[s].setupProgram(i)}o.shouldProxyForStyle(e)&&(this.view.setupTile(o,i),this.styles[e].render(o.meshes[e])&&(this.view.panning||this.view.zooming||this.requestRedraw()),n+=o.meshes[e].geometry_count)}}return n}},{key:"clearFrame",value:function(){var e=arguments.length<=0||void 0===arguments[0]?{}:arguments[0],t=e.clear_color,r=e.clear_depth;if(this.initialized){t=t===!1?!1:!0,r=r===!1?!1:!0,this.render_states.depth_write.set({depth_write:r});var n=this.gl;if(t||r){var i=(t&&n.COLOR_BUFFER_BIT)|(r&&n.DEPTH_BUFFER_BIT);n.clear(i)}}}},{key:"setRenderState",value:function(){var e=arguments.length<=0||void 0===arguments[0]?{}:arguments[0],t=e.depth_test,r=e.depth_write,n=e.cull_face,i=e.blend;if(this.initialized){var a=this.render_states;t=t===!1?!1:a.defaults.depth_test,r=r===!1?!1:a.defaults.depth_write,n=n===!1?!1:a.defaults.culling,i=null!=i?i:a.defaults.blending;var o=this.gl;a.depth_test.set({depth_test:t}),a.depth_write.set({depth_write:r}),a.culling.set({cull:n,face:a.defaults.culling_face}),i?"opaque"===i?a.blending.set({blend:!0,src:o.SRC_ALPHA,dst:o.ZERO}):"overlay"===i||"inlay"===i?a.blending.set({blend:!0,src:o.SRC_ALPHA,dst:o.ONE_MINUS_SRC_ALPHA,src_alpha:o.ONE,dst_alpha:o.ONE_MINUS_SRC_ALPHA}):"add"===i?a.blending.set({blend:!0,src:o.ONE,dst:o.ONE,src_alpha:o.ONE,dst_alpha:o.ONE_MINUS_SRC_ALPHA}):"multiply"===i&&a.blending.set({blend:!0,src:o.ZERO,dst:o.SRC_COLOR,src_alpha:o.ONE,dst_alpha:o.ONE_MINUS_SRC_ALPHA}):a.blending.set({blend:!1})}}},{key:"getFeatureAt",value:function(e){if(!this.initialized)return T.default("debug","Scene.getFeatureAt() called before scene was initialized"),d.default.resolve();var t={x:e.x*S.default.device_pixel_ratio/this.view.size.device.width,y:e.y*S.default.device_pixel_ratio/this.view.size.device.height};return this.dirty=!0,this.selection.getFeatureAt(t).then(function(t){return f.default(t,{pixel:e})}).catch(function(e){return d.default.resolve({error:e})})}},{key:"rebuild",value:function(e){return this.rebuildGeometry(e)}},{key:"rebuildGeometry",value:function(){var e=this,t=arguments.length<=0||void 0===arguments[0]?{}:arguments[0],r=t.sync,n=void 0===r?!0:r,i=t.sources,a=void 0===i?null:i,o=t.serialize_funcs,s=t.profile,l=void 0===s?!1:s,u=t.fade_in,c=void 0===u?!1:u;return new d.default(function(t,r){return e.building?(e.building.queued&&e.building.queued.reject&&(T.default("debug","Scene.rebuild: request superceded by a newer call"),e.building.queued.resolve(!1)),e.building.queued={resolve:t,reject:r},void T.default("trace","Scene.rebuild(): queuing request")):(e.building={resolve:t,reject:r},l&&e._profile("Scene.rebuild"),n&&(e.syncConfigToWorker({serialize_funcs:o}),e.style_manager.compile(e.updateActiveStyles(),e)),e.resetFeatureSelection(),e.resetTime(),e.tile_manager.pruneToVisibleTiles(),e.tile_manager.forEachTile(function(t){(!a||a.indexOf(t.source.name)>-1)&&e.tile_manager.buildTile(t,{fade_in:c})}),e.tile_manager.updateTilesForView(),void e.tile_manager.checkBuildQueue())}).then(function(){l&&e._profileEnd("Scene.rebuild")})}},{key:"tileManagerBuildDone",value:function(){if(this.building){T.default("info","Scene: build geometry finished"),this.building.resolve&&this.building.resolve(!0);var e=this.building.queued;this.building=null,e&&(T.default("debug","Scene: starting queued rebuild() request"),this.rebuild().then(e.resolve,e.reject))}}},{key:"loadScene",value:function(){var e=this,t=arguments.length<=0||void 0===arguments[0]?null:arguments[0],r=arguments.length<=1||void 0===arguments[1]?null:arguments[1];return this.config_source=t||this.config_source,this.config_globals_applied=[],this.config_path=S.default.pathForURL("string"==typeof this.config_source?r||this.config_source:r),G.default.loadScene(this.config_source,this.config_path).then(function(t){return e.config=t,e.trigger("load",{config:e.config}),e.config})}},{key:"setDataSource",value:function(e,t){if(!e||!t||!t.type||!t.url&&!t.data)return void T.default("error","No name provided or not a valid config:",e,t);var r=null==this.config.sources[e],n=this.config.sources[e]=f.default({},t);return n.data&&"object"===y.default(n.data)&&(n.url=S.default.createObjectURL(new Blob([u.default(n.data)])),delete n.data),r?this.updateConfig({rebuild:{sources:[e]}}):this.rebuild({sources:[e]})}},{key:"createDataSources",value:function(){var e=[],t=m.default(this.sources);for(var r in this.config.sources){var n=this.config.sources[r],i=this.sources[r];try{if(this.sources[r]=J.default.create(f.default({},n,{name:r}),this.sources),!this.sources[r])throw{}}catch(a){delete this.sources[r];var o="Could not create data source: "+a.message;T.default("warn","Scene: "+o,n),this.trigger("warning",{type:"sources",source:n,message:o})}J.default.changed(this.sources[r],i)&&e.push(r)}var l=!0,u=!1,c=void 0;try{for(var h,d=s.default(t);!(l=(h=d.next()).done);l=!0){var p=h.value;this.config.sources[p]||(delete this.sources[p],e.push(p))}}catch(_){u=!0,c=_}finally{try{!l&&d.return&&d.return()}finally{if(u)throw c}}e.length>0&&this.tile_manager.removeTiles(function(t){return e.indexOf(t.source.name)>-1});var g=!0,v=!1,y=void 0;try{for(var b,x=s.default(S.default.values(this.config.layers));!(g=(b=x.next()).done);g=!0){var w=b.value;w.data&&this.sources[w.data.source]&&(this.sources[w.data.source].builds_geometry_tiles=!0)}}catch(_){v=!0,y=_}finally{try{!g&&x.return&&x.return()}finally{if(v)throw y}}}},{key:"loadTextures",value:function(){var e=this;return L.default.createFromObject(this.gl,this.config.textures).then(function(){return L.default.createDefault(e.gl)})}},{key:"updateStyles",value:function(){if(!this.initialized&&!this.initializing)throw new Error("Scene.updateStyles() called before scene was initialized");this.styles=this.style_manager.build(this.config.styles),this.style_manager.initStyles(this);var e=!0,t=!1,r=void 0;try{for(var n,i=s.default(S.default.values(this.styles));!(e=(n=i.next()).done);e=!0){var a=n.value;a.setGL(this.gl)}}catch(o){t=!0,r=o}finally{try{!e&&i.return&&i.return()}finally{if(t)throw r}}this.updateActiveStyles(),this.style_manager.compile(m.default(this.active_styles),this),this.dirty=!0}},{key:"updateActiveStyles",value:function(){var e=this,t=m.default(this.active_styles||{});this.active_styles={};var r=!1,n=!0,i=!1,o=void 0;try{for(var l,u=s.default(S.default.recurseValues(this.config.layers));!(n=(l=u.next()).done);n=!0){var c=l.value;if(c&&c.draw){var f=!0,h=!1,d=void 0;try{for(var p,_=s.default(S.default.entries(c.draw));!(f=(p=_.next()).done);f=!0){var g=a.default(p.value,2),v=g[0],b=g[1];if(null!=b&&"object"===("undefined"==typeof b?"undefined":y.default(b))&&b.visible!==!1){var x=b.style||v,w=[x];b.outline&&b.outline.style&&w.push(b.outline.style),w=w.filter(function(t){return e.styles[t]}).forEach(function(t){var n=e.styles[t];n&&(e.active_styles[t]=!0,n.animated&&(r=!0))})}}}catch(k){h=!0,d=k}finally{try{!f&&_.return&&_.return()}finally{if(h)throw d}}}}}catch(k){i=!0,o=k}finally{try{!n&&u.return&&u.return()}finally{if(i)throw o}}return this.animated=void 0!==this.config.scene.animated?this.config.scene.animated:r,m.default(this.active_styles).filter(function(e){return-1===t.indexOf(e)})}},{key:"getActiveCamera",value:function(){return this.view.getActiveCamera()}},{key:"setActiveCamera",value:function(e){return this.view.setActiveCamera(e)}},{key:"createLights",value:function(){this.lights={};for(var e in this.config.lights)if(this.config.lights[e]&&"object"===y.default(this.config.lights[e])){var t=this.config.lights[e];t.name=e.replace("-","_"),t.visible=t.visible===!1?!1:!0,t.visible&&(this.lights[t.name]=Z.default.create(this.view,t))}Z.default.inject(this.lights)}},{key:"setBackground",value:function(){var e,t=this.config.scene.background;this.background={},t&&t.color&&(this.background.color=D.StyleParser.parseColor(t.color)),this.background.color||(this.background.color=[0,0,0,0]),this.canvas.style.backgroundColor=1===this.background.color[3]?"rgba("+this.background.color.map(function(e){return Math.floor(255*e)}).join(", ")+")":"transparent",(e=this.gl).clearColor.apply(e,g.default(this.background.color))}},{key:"setIntrospection",value:function(e){this.introspection=e||!1,this.updateConfig()}},{key:"updateConfig",value:function(){var t=this,r=arguments.length<=0||void 0===arguments[0]?{}:arguments[0],n=r.rebuild,i=void 0===n?!0:n,a=r.serialize_funcs,o=r.fade_in,s=void 0===o?!1:o;this.generation=++e.generation,this.updating++,this.config=G.default.applyGlobalProperties(this.config,this.config_globals_applied),this.style_manager.init(),this.view.reset(),this.createLights(),this.createDataSources(),this.loadTextures(),this.setBackground(),rt.default.loadFonts(this.config.fonts),this.updateStyles();var l=i?this.rebuild(f.default({serialize_funcs:a,fade_in:s},"object"===("undefined"==typeof i?"undefined":y.default(i))&&i)):this.syncConfigToWorker({serialize_funcs:a});return l.then(function(){t.updating--,t.view.updateBounds(),t.requestRedraw()})}},{key:"syncConfigToWorker",value:function(){var e=arguments.length<=0||void 0===arguments[0]?{}:arguments[0],t=e.serialize_funcs,r=void 0===t?!0:t;return this.config_serialized=r?S.default.serializeWithFunctions(this.config):u.default(this.config),j.default.postMessage(this.workers,"self.updateConfig",{config:this.config_serialized,generation:this.generation,introspection:this.introspection})}},{key:"createListeners",value:function(){var e=this;this.listeners={},this.listeners.view={move:function(){return e.trigger("move")}},this.view.subscribe(this.listeners.view),this.listeners.texture={update:function(){return e.dirty=!0},warning:function(t){return e.trigger("warning",f.default({type:"textures"},t))}},L.default.subscribe(this.listeners.texture),this.listeners.scene_loader={error:function(t){return e.trigger("error",f.default({type:"scene"},t))}},G.default.subscribe(this.listeners.scene_loader)}},{key:"destroyListeners",value:function(){this.unsubscribeAll(),this.view.unsubscribe(this.listeners.view),L.default.unsubscribe(this.listeners.texture),G.default.unsubscribe(this.listeners.scene_loader),this.listeners=null}},{key:"resetFeatureSelection",value:function(){this.selection?this.workers&&j.default.postMessage(this.workers,"self.resetFeatureSelection"):this.selection=new $.default(this.gl,this.workers)}},{key:"getFeatureSelectionMapSize",value:function(){var e=this;return this.fetching_selection_map?d.default.resolve():(this.fetching_selection_map=!0,j.default.postMessage(this.workers,"self.getFeatureSelectionMapSize").then(function(t){return e.fetching_selection_map=!1,t.reduce(function(e,t){return e+t})}))}},{key:"resetTime",value:function(){this.start_time=+new Date}},{key:"updateViewComplete",value:function(){!this.render_count_changed&&this.generation===this.last_complete_generation||this.tile_manager.isLoadingVisibleTiles()||(this.last_complete_generation=this.generation,this.trigger("view_complete"))}},{key:"resetViewComplete",value:function(){this.last_complete_generation=null}},{key:"screenshot",value:function(){return this.requestRedraw(),this.media_capture.screenshot()}},{key:"startVideoCapture",value:function(){return this.requestRedraw(),this.media_capture.startVideoCapture()}},{key:"stopVideoCapture",value:function(){return this.media_capture.stopVideoCapture()}},{key:"_profile",value:function(e){console.profile("main thread: "+e),j.default.postMessage(this.workers,"self.profile",e)}},{key:"_profileEnd",value:function(e){console.profileEnd("main thread: "+e),j.default.postMessage(this.workers,"self.profileEnd",e)}},{key:"setupDebug",value:function(){var e=this;this.debug={timeRebuild:function(){var t=arguments.length<=0||void 0===arguments[0]?1:arguments[0],r=arguments.length<=1||void 0===arguments[1]?{}:arguments[1],n=[],i=function a(){var i=+new Date;e.rebuild(r).then(function(){if(n.push(+new Date-i),n.length<t)a();else{var e=~~(n.reduce(function(e,t){return e+t})/n.length);T.default("info","Profiled rebuild "+t+" times: "+e+" avg ("+Math.min.apply(Math,n)+" min, "+Math.max.apply(Math,n)+" max)")}})};i()},geometryCountByStyle:function(){var t={},r=!0,n=!1,i=void 0;try{for(var a,o=s.default(e.tile_manager.getRenderableTiles());!(r=(a=o.next()).done);r=!0){var l=a.value;for(var u in l.meshes)t[u]=t[u]||0,t[u]+=l.meshes[u].geometry_count}}catch(c){n=!0,i=c}finally{try{!r&&o.return&&o.return()}finally{if(n)throw i}}return t},geometryCountByBaseStyle:function(){var t=e.debug.geometryCountByStyle(),r={};for(var n in t){var i=e.styles[n].built_in?n:e.styles[n].base;r[i]=r[i]||0,r[i]+=t[n]}return r}}}}],[{key:"create",value:function(t){var r=arguments.length<=1||void 0===arguments[1]?{}:arguments[1];return new e(t,r)}}]),e}();r.default=at,at.id=0,at.generation=0},{"./gl/context":301,"./gl/render_state":304,"./gl/texture":306,"./gl/vao":307,"./light":319,"./scene_loader":324,"./selection":326,"./sources/data_source":327,"./styles/style":338,"./styles/style_manager":339,"./styles/style_parser":340,"./styles/text/font_manager":342,"./tile_manager":347,"./utils/log":352,"./utils/media_capture":353,"./utils/subscribe":356,"./utils/utils":358,"./utils/worker_broker":360,"./view":362,"babel-runtime/core-js/get-iterator":4,"babel-runtime/core-js/json/stringify":6,"babel-runtime/core-js/object/assign":9,"babel-runtime/core-js/object/keys":15,"babel-runtime/core-js/promise":17,"babel-runtime/helpers/classCallCheck":21,"babel-runtime/helpers/createClass":22,"babel-runtime/helpers/slicedToArray":27,"babel-runtime/helpers/toConsumableArray":28,"babel-runtime/helpers/typeof":29}],323:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function i(e,t,r){var n=arguments.length<=3||void 0===arguments[3]?null:arguments[3];return"zip"===n||"string"==typeof e&&"zip"===w.default.extensionForURL(e)?new E(e,t,r):new T(e,t,r)}Object.defineProperty(r,"__esModule",{value:!0}),r.ZipSceneBundle=r.SceneBundle=void 0;var a=e("babel-runtime/core-js/object/keys"),o=n(a),s=e("babel-runtime/core-js/promise"),l=n(s),u=e("babel-runtime/core-js/object/get-prototype-of"),c=n(u),f=e("babel-runtime/helpers/possibleConstructorReturn"),h=n(f),d=e("babel-runtime/helpers/get"),p=n(d),m=e("babel-runtime/helpers/inherits"),_=n(m),g=e("babel-runtime/helpers/classCallCheck"),v=n(g),y=e("babel-runtime/helpers/createClass"),b=n(y);r.createSceneBundle=i;var x=e("./utils/utils"),w=n(x),k=e("jszip"),A=n(k),T=r.SceneBundle=function(){function e(t,r){var n=arguments.length<=2||void 0===arguments[2]?null:arguments[2];v.default(this,e),this.url=t,this.path=!r||w.default.isRelativeURL(r)&&!w.default.isRelativeURL(this.url)?w.default.pathForURL(this.url):r,this.path_for_parent=r||this.path,this.parent=n,this.container=null,this.parent&&(this.parent.container?this.container=this.parent.container:this.parent.isContainer()&&(this.container=this.parent))}return b.default(e,[{key:"load",value:function(){return w.default.loadResource(this.url)}},{key:"resourceFor",value:function(e){return{url:this.urlFor(e),path:this.pathFor(e),type:this.typeFor(e)}}},{key:"urlFor",value:function(e){return w.default.isRelativeURL(e)&&this.container?this.parent.urlFor(this.path_for_parent+e):w.default.addBaseURL(e,this.path)}},{key:"pathFor",value:function(e){return w.default.pathForURL(e)}},{key:"typeFor",value:function(e){return w.default.extensionForURL(e)}},{key:"isContainer",value:function(){return!1}}]),e}(),E=r.ZipSceneBundle=function(e){function t(e,r,n){v.default(this,t);var i=h.default(this,c.default(t).call(this,e,r,n));return i.zip=null,i.files={},i.root=null,i.path="",i}return _.default(t,e),b.default(t,[{key:"isContainer",value:function(){return!0}},{key:"load",value:function(){var e=this;return this.zip=new A.default,"string"==typeof this.url?w.default.io(this.url,6e4,"arraybuffer").then(function(t){return e.zip.loadAsync(t)}).then(function(){return e.parseZipFiles()}).then(function(){return e.loadRoot()}).catch(function(e){return l.default.reject(e)}):l.default.resolve(this)}},{key:"urlFor",value:function(e){return w.default.isRelativeURL(e)?this.urlForZipFile(w.default.flattenRelativeURL(e)):p.default(c.default(t.prototype),"urlFor",this).call(this,e)}},{key:"typeFor",value:function(e){return w.default.isRelativeURL(e)?this.typeForZipFile(e):p.default(c.default(t.prototype),"typeFor",this).call(this,e)}},{key:"loadRoot",value:function(){var e=this;return this.findRoot().then(function(){return w.default.loadResource(e.urlForZipFile(e.root))})}},{key:"findRoot",value:function(){var e=this,t=o.default(this.files).filter(function(t){return 0===e.files[t].depth}).filter(function(e){return"yaml"===w.default.extensionForURL(e)});if(1===t.length&&(this.root=t[0]),!this.root){var r="Could not find root scene for bundle '"+this.url+"': ";return r+="The zip archive's root level must contain a single scene file with the '.yaml' extension. ",r+=t.length>0?"Found multiple YAML files at the root level: "+t.map(function(e){return"'"+e+"'"}).join(", ")+".":"Found NO YAML files at the root level.",l.default.reject(Error(r))}return l.default.resolve()}},{key:"parseZipFiles",value:function(){var e=this,t=[],r=[];return this.zip.forEach(function(e,n){n.dir||(t.push(e),r.push(n.async("arraybuffer")))}),l.default.all(r).then(function(r){for(var n=0;n<r.length;n++){var i=t[n],a=i.split("/").length-1;e.files[i]={data:r[n],type:w.default.extensionForURL(i),depth:a}}})}},{key:"urlForZipFile",value:function(e){return this.files[e]?(this.files[e].url||(this.files[e].url=w.default.createObjectURL(new Blob([this.files[e].data]))),this.files[e].url):void 0}},{key:"typeForZipFile",value:function(e){return this.files[e]&&this.files[e].type}}]),t}(T)},{"./utils/utils":358,"babel-runtime/core-js/object/get-prototype-of":14,"babel-runtime/core-js/object/keys":15,"babel-runtime/core-js/promise":17,"babel-runtime/helpers/classCallCheck":21,"babel-runtime/helpers/createClass":22,"babel-runtime/helpers/get":24,"babel-runtime/helpers/inherits":25,"babel-runtime/helpers/possibleConstructorReturn":26,jszip:226}],324:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function i(e){var t=arguments.length<=1||void 0===arguments[1]?":":arguments[1],r=arguments.length<=2||void 0===arguments[2]?null:arguments[2],n=arguments.length<=3||void 0===arguments[3]?{}:arguments[3];r=r?r+t:"";for(var a in e){var o=r+a,l=e[a];n[o]=l,"object"!==("undefined"==typeof l?"undefined":s.default(l))||Array.isArray(l)||i(l,t,o,n)}return n}Object.defineProperty(r,"__esModule",{value:!0});var a,o=e("babel-runtime/helpers/typeof"),s=n(o),l=e("babel-runtime/core-js/object/keys"),u=n(l),c=e("babel-runtime/core-js/get-iterator"),f=n(c),h=e("babel-runtime/helpers/toConsumableArray"),d=n(h),p=e("babel-runtime/core-js/promise"),m=n(p),_=e("./utils/log"),g=n(_),v=e("./utils/utils"),y=n(v),b=e("./gl/glsl"),x=n(b),w=e("./utils/merge"),k=n(w),A=e("./utils/subscribe"),T=n(A),E=e("./scene_bundle");r.default=a={loadScene:function(e){var t=this,r=arguments.length<=1||void 0===arguments[1]?null:arguments[1],n=[];return this.loadSceneRecursive({url:e,path:r},null,n).then(function(e){return t.finalize(e)}).then(function(e){return e?(n.length>0&&n.forEach(function(e){var r="Failed to import scene: "+e.url;g.default("error",r,e),t.trigger("error",{type:"scene_import",message:r,error:e,url:e.url})}),e):m.default.reject(n[0])})},loadSceneRecursive:function(e,t){var r=e.url,n=e.path,i=e.type,a=this,o=arguments.length<=2||void 0===arguments[2]?[]:arguments[2];if(!r)return m.default.resolve({});var s=E.createSceneBundle(r,n,t,i);return s.load().then(function(e){if("string"==typeof e.import&&(e.import=[e.import]),!Array.isArray(e.import))return a.normalize(e,s),e;var t=[],r=!0,n=!1,i=void 0;try{for(var l,u=f.default(e.import);!(r=(l=u.next()).done);r=!0){var c=l.value;t.push(s.resourceFor(c))}}catch(h){n=!0,i=h}finally{try{!r&&u.return&&u.return()}finally{if(n)throw i}}return delete e.import,m.default.all(t.map(function(e){return a.loadSceneRecursive(e,s,o)})).then(function(t){return e=k.default.apply(void 0,[{}].concat(d.default(t),[e])),a.normalize(e,s),e})}).catch(function(e){e.url=r,o.push(e)})},normalize:function(e,t){return this.normalizeDataSources(e,t),this.normalizeFonts(e,t),this.normalizeTextures(e,t),e},normalizeDataSources:function(e,t){e.sources=e.sources||{};var r=!0,n=!1,i=void 0;try{for(var a,o=f.default(y.default.values(e.sources));!(r=(a=o.next()).done);r=!0){var s=a.value;s.url=t.urlFor(s.url),Array.isArray(s.scripts)&&(s.scripts=s.scripts.map(function(e){return t.urlFor(e)}))}}catch(l){n=!0,i=l}finally{try{!r&&o.return&&o.return()}finally{if(n)throw i}}return e},normalizeFonts:function(e,t){e.fonts=e.fonts||{};var r=!0,n=!1,i=void 0;try{for(var a,o=f.default(y.default.recurseValues(e.fonts));!(r=(a=o.next()).done);r=!0){var s=a.value;s.url&&(s.url=t.urlFor(s.url))}}catch(l){n=!0,i=l}finally{try{!r&&o.return&&o.return()}finally{if(n)throw i}}return e},normalizeTextures:function(e,t){if(e.textures=e.textures||{},e.textures){var r=!0,n=!1,i=void 0;try{for(var a,o=f.default(y.default.values(e.textures));!(r=(a=o.next()).done);r=!0){var s=a.value;s.url&&(s.url=t.urlFor(s.url))}}catch(l){n=!0,i=l}finally{try{!r&&o.return&&o.return()}finally{if(n)throw i}}}if(e.styles){var u=!0,c=!1,h=void 0;try{for(var d,p=f.default(y.default.values(e.styles));!(u=(d=p.next()).done);u=!0){var m=d.value,_=m.texture;if("string"!=typeof _||e.textures[_]||(_=t.urlFor(_),e.textures[_]={url:_},m.texture=_),m.material)for(var g=["emission","ambient","diffuse","specular","normal"],v=0;v<g.length;v++){var b=g[v],w=null!=m.material[b]&&m.material[b].texture;"string"!=typeof w||e.textures[w]||(w=t.urlFor(w),e.textures[w]={url:w},m.material[b].texture=w)}if(m.shaders&&m.shaders.uniforms){var k=!0,A=!1,T=void 0;try{for(var E,S=f.default(x.default.parseUniforms(m.shaders.uniforms));!(k=(E=S.next()).done);k=!0){var R=E.value,j=R.type,M=R.value,z=R.key,C=R.uniforms;if("sampler2D"===j&&"string"==typeof M&&!e.textures[M]){var P=t.urlFor(M);e.textures[P]={url:P},C[z]=P}}}catch(l){A=!0,T=l}finally{try{!k&&S.return&&S.return()}finally{if(A)throw T}}}}}catch(l){c=!0,h=l}finally{try{!u&&p.return&&p.return()}finally{if(c)throw h}}}return e},applyGlobalProperties:function(e,t){function r(e,i,o){if("string"==typeof e){var l="global."===e.slice(0,7)&&e.slice(7).replace(/\./g,n);l&&void 0!==a[l]&&(t.push({prop:l,target:i,key:o}),e=a[l])}else if("object"===("undefined"==typeof e?"undefined":s.default(e)))for(var u in e)e[u]=r(e[u],e,u);return e}if(!e.global||0===u.default(e.global).length)return e;var n=":",a=i(e.global,n);return t.forEach(function(e){var t=e.prop,r=e.target,n=e.key;r&&(r[n]=a[t])}),r(e)},finalize:function(e){if(e){e.scene=e.scene||{},e.cameras=e.cameras||{},e.lights=e.lights||{},e.styles=e.styles||{},e.layers=e.layers||{};var t=0;for(var r in e.sources)e.sources[r].id=t++;return e.camera&&(e.cameras.default=e.camera),0===u.default(e.cameras).length&&(e.cameras.default={}),(0===u.default(e.lights).length||u.default(e.lights).every(function(t){return e.lights[t].visible===!1}))&&(e.lights.default_light={type:"directional"}),e}}},T.default(a)},{"./gl/glsl":303,"./scene_bundle":323,"./utils/log":352,"./utils/merge":354,"./utils/subscribe":356,"./utils/utils":358,"babel-runtime/core-js/get-iterator":4,"babel-runtime/core-js/object/keys":15,"babel-runtime/core-js/promise":17,"babel-runtime/helpers/toConsumableArray":28,"babel-runtime/helpers/typeof":29}],325:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(r,"__esModule",{value:!0}),r.SceneWorker=void 0;{var i=e("babel-runtime/helpers/toConsumableArray"),a=n(i),o=e("babel-runtime/core-js/promise"),s=n(o),l=e("babel-runtime/core-js/json/stringify"),u=n(l),c=e("babel-runtime/core-js/object/keys"),f=n(c),h=e("babel-runtime/core-js/object/assign"),d=n(h),p=e("./utils/thread"),m=n(p),_=e("./utils/utils"),g=n(_),v=e("./utils/log"),y=n(v),b=e("./utils/worker_broker"),x=n(b),w=e("./utils/merge"),k=n(w),A=e("./tile"),T=n(A),E=e("./sources/data_source"),S=n(E),R=e("./selection"),j=n(R),M=e("./styles/style_parser"),z=e("./styles/style_manager"),C=e("./styles/layer"),P=e("./gl/texture"),N=n(P);r.SceneWorker=self}m.default.is_worker&&(d.default(self,{FeatureSelection:j.default,sources:{tiles:{},objects:{}},styles:{},layers:{},tiles:{},objects:{},config:{},init:function(e,t,r,n,i){return self.scene_id=e,self._worker_id=t,self.num_workers=r,y.default.setLevel(n),g.default.device_pixel_ratio=i,j.default.setPrefix(self._worker_id),self.style_manager=new z.StyleManager,t},updateConfig:function(e){var t=e.config,r=e.generation,n=e.introspection;t=JSON.parse(t),self.last_config=k.default({},self.config),self.config=k.default({},t),self.generation=r,self.introspection=n;for(var i in t.layers)t.layers[i]&&(t.layers[i].data=g.default.stringsToFunctions(t.layers[i].data));self.global=g.default.stringsToFunctions(t.global),self.createDataSources(t),t.styles=g.default.stringsToFunctions(t.styles,M.StyleParser.wrapFunction),self.styles=self.style_manager.build(t.styles),self.style_manager.initStyles({generation:self.generation,styles:self.styles,sources:self.sources.tiles,introspection:self.introspection}),self.layers=C.parseLayers(t.layers,self.style_manager.styles),self.syncing_textures=self.syncTextures(t.textures),self.configuring=self.syncing_textures.then(function(){y.default("debug","updated config")})},createDataSources:function(e){e.sources=g.default.stringsToFunctions(e.sources),self.sources.tiles={};for(var t in e.sources){var r=void 0;try{r=S.default.create(d.default({},e.sources[t],{name:t}),self.sources.tiles)}catch(n){continue}r&&(r.tiled?self.sources.tiles[t]=r:r.id%self.num_workers===self._worker_id&&(self.sources.objects[t]=r,self.objects[r.name]||(self.objects[r.name]={},r.load(self.objects[r.name]))))}self.config.sources&&self.last_config.sources&&!f.default(self.config.sources).some(function(e){return u.default(self.config.sources[e])!==u.default(self.last_config.sources[e])})||(self.tiles={})},awaitConfiguration:function(){return self.configuring},buildTile:function(e){var t=e.tile;if(null==self.getTile(t.key)||self.getTile(t.key).loading!==!0)return t=self.tiles[t.key]=d.default(self.getTile(t.key)||{},t),self.awaitConfiguration().then(function(){if(t.loaded!==!0)t.loading=!0,t.loaded=!1,t.error=null,self.loadTileSourceData(t).then(function(){return self.getTile(t.key)?(t.source_data.error&&y.default("warn","tile load error(s) for "+t.key+": "+t.source_data.error.stack),t.loading=!1,t.loaded=!0,void T.default.buildGeometry(t,self)):void y.default("trace","stop tile build after data source load because tile was removed: "+t.key)}).catch(function(e){t.loading=!1,t.loaded=!1,t.error=e.stack,y.default("error","tile load error for "+t.key+": "+t.error),x.default.postMessage("TileManager_"+self.scene_id+".buildTileError",T.default.slice(t))});else{y.default("trace","used worker cache for tile "+t.key);try{T.default.buildGeometry(t,self)}catch(e){t.error=e.toString(),x.default.postMessage("TileManager_"+self.scene_id+".buildTileError",T.default.slice(t))}}})},loadTileSourceData:function(e){return self.sources.tiles[e.source]?self.sources.tiles[e.source].load(e):(e.source_data={error:"Data source '"+e.source+"' not found"},s.default.resolve(e))},getTile:function(e){return self.tiles[e]},removeTile:function(e){var t=self.tiles[e];null!=t&&(t.loading===!0&&(y.default("trace","cancel tile load for "+e),t.loading=!1,T.default.cancel(t)),j.default.clearTile(e),delete self.tiles[e],y.default("trace","remove tile from cache for "+e))},getFeatureSelection:function(){var e=arguments.length<=0||void 0===arguments[0]?{}:arguments[0],t=e.id,r=e.key,n=j.default.map[r];return{id:t,feature:n&&n.feature}},resetFeatureSelection:function(){j.default.reset()},getFeatureSelectionMapSize:function(){return j.default.getMapSize()},syncTextures:function(e){var t=[];return e&&t.push.apply(t,a.default(f.default(e))),y.default("trace","sync textures to worker:",t),t.length>0?N.default.syncTexturesToWorker(t):s.default.resolve()},updateDevicePixelRatio:function(e){g.default.device_pixel_ratio=e},profile:function(e){console.profile("worker "+self._worker_id+": "+e)},profileEnd:function(e){console.profileEnd("worker "+self._worker_id+": "+e)}}),x.default.addTarget("self",self))},{"./gl/texture":306,"./selection":326,"./sources/data_source":327,"./styles/layer":332,"./styles/style_manager":339,"./styles/style_parser":340,"./tile":346,"./utils/log":352,"./utils/merge":354,"./utils/thread":357,"./utils/utils":358,"./utils/worker_broker":360,"babel-runtime/core-js/json/stringify":6,"babel-runtime/core-js/object/assign":9,"babel-runtime/core-js/object/keys":15,"babel-runtime/core-js/promise":17,"babel-runtime/helpers/toConsumableArray":28}],326:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(r,"__esModule",{value:!0});var i=e("babel-runtime/core-js/json/stringify"),a=n(i),o=e("babel-runtime/core-js/promise"),s=n(o),l=e("babel-runtime/helpers/classCallCheck"),u=n(l),c=e("babel-runtime/helpers/createClass"),f=n(c),h=e("./utils/log"),d=n(h),p=e("./gl/texture"),m=n(p),_=e("./utils/worker_broker"),g=n(_),v=function(){function e(t,r){u.default(this,e),this.gl=t,this.workers=r,this.init()}return f.default(e,[{key:"init",value:function(){this.requests={},this.feature=null,this.read_delay=5,this.read_delay_timer=null,this.pixel=new Uint8Array(4),this.pixel32=new Float32Array(this.pixel.buffer),this.fbo=this.gl.createFramebuffer(),this.gl.bindFramebuffer(this.gl.FRAMEBUFFER,this.fbo),this.fbo_size={width:256,height:256},this.fbo_size.aspect=this.fbo_size.width/this.fbo_size.height;var e=m.default.create(this.gl,"selection_fbo",{filtering:"nearest"});e.setData(this.fbo_size.width,this.fbo_size.height,null,{filtering:"nearest"}),this.gl.framebufferTexture2D(this.gl.FRAMEBUFFER,this.gl.COLOR_ATTACHMENT0,this.gl.TEXTURE_2D,e.texture,0);var t=this.gl.createRenderbuffer();this.gl.bindRenderbuffer(this.gl.RENDERBUFFER,t),this.gl.renderbufferStorage(this.gl.RENDERBUFFER,this.gl.DEPTH_COMPONENT16,this.fbo_size.width,this.fbo_size.height),this.gl.framebufferRenderbuffer(this.gl.FRAMEBUFFER,this.gl.DEPTH_ATTACHMENT,this.gl.RENDERBUFFER,t),this.gl.bindFramebuffer(this.gl.FRAMEBUFFER,null)}},{key:"destroy",value:function(){this.gl&&this.fbo&&(this.gl.deleteFramebuffer(this.fbo),this.fbo=null,this.gl.bindFramebuffer(this.gl.FRAMEBUFFER,null))}},{key:"bind",value:function(){this.gl.bindFramebuffer(this.gl.FRAMEBUFFER,this.fbo),this.gl.viewport(0,0,this.fbo_size.width,this.fbo_size.height)}},{key:"getFeatureAt",value:function(e){var t=this;return new s.default(function(r,n){t.selection_request_id=t.selection_request_id+1||0,t.requests[t.selection_request_id]={type:"point",id:t.selection_request_id,point:e,resolve:r,reject:n}})}},{key:"pendingRequests",value:function(){return this.requests}},{key:"clearPendingRequests",value:function(){for(var e in this.requests){var t=this.requests[e];t.sent||(t.reject({request:t}),delete this.requests[e])}}},{key:"read",value:function(){var e=this;null!=this.read_delay_timer&&clearTimeout(this.read_delay_timer),this.read_delay_timer=setTimeout(function(){var t=e.gl;t.bindFramebuffer(t.FRAMEBUFFER,e.fbo);for(var r in e.requests){var n=e.requests[r];if(!n.sent&&"point"===n.type){t.readPixels(Math.floor(n.point.x*e.fbo_size.width),Math.floor((1-n.point.y)*e.fbo_size.height),1,1,t.RGBA,t.UNSIGNED_BYTE,e.pixel); 15 var i=e.pixel[0]+(e.pixel[1]<<8)+(e.pixel[2]<<16)+(e.pixel[3]<<24)>>>0,a=e.pixel[3];255!==a?null!=e.workers[a]&&g.default.postMessage(e.workers[a],"self.getFeatureSelection",{id:n.id,key:i}).then(function(t){e.finishRead(t)}):e.finishRead({id:n.id,feature:null}),n.sent=!0}}t.bindFramebuffer(t.FRAMEBUFFER,null)},this.read_delay)}},{key:"finishRead",value:function(e){var t=this.requests[e.id];if(!t)return void d.default("error","FeatureSelection.finishRead(): could not find message",e);var r=e.feature,n=!1;(null!=r&&null==this.feature||null==r&&null!=this.feature||null!=r&&null!=this.feature&&a.default(r)!==a.default(this.feature))&&(n=!0),this.feature=r,t.resolve({feature:r,changed:n,request:t}),delete this.requests[e.id]}}],[{key:"makeEntry",value:function(e){this.map_entry++;var t=255&this.map_entry,r=this.map_entry>>8&255,n=this.map_entry>>16&255,i=this.map_prefix,a=t/255,o=r/255,s=n/255,l=i/255,u=t+(r<<8)+(n<<16)+(i<<24)>>>0;return this.map[u]={color:[a,o,s,l]},this.map_size++,this.tiles[e.key]||(this.tiles[e.key]={entries:[],tile:{key:e.key,coords:e.coords,style_zoom:e.style_zoom,source:e.source,generation:e.generation}}),this.tiles[e.key].entries.push(u),this.map[u]}},{key:"makeColor",value:function(e,t,r){var n=this.makeEntry(t);return n.feature={id:e.id,properties:e.properties,source_name:r.source,source_layer:r.layer,layers:r.layers,tile:this.tiles[t.key].tile},n.color}},{key:"reset",value:function(){this.tiles={},this.map={},this.map_size=0,this.map_entry=0}},{key:"clearTile",value:function(e){var t=this;this.tiles[e]&&(this.tiles[e].entries.forEach(function(e){return delete t.map[e]}),this.map_size-=this.tiles[e].entries.length,delete this.tiles[e])}},{key:"getMapSize",value:function(){return this.map_size}},{key:"setPrefix",value:function(e){this.map_prefix=e}}]),e}();r.default=v,v.map={},v.tiles={},v.map_size=0,v.map_entry=0,v.map_prefix=0,v.defaultColor=[0,0,0,1]},{"./gl/texture":306,"./utils/log":352,"./utils/worker_broker":360,"babel-runtime/core-js/json/stringify":6,"babel-runtime/core-js/promise":17,"babel-runtime/helpers/classCallCheck":21,"babel-runtime/helpers/createClass":22}],327:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(r,"__esModule",{value:!0}),r.NetworkTileSource=r.NetworkSource=void 0;var i=e("babel-runtime/helpers/get"),a=n(i),o=e("babel-runtime/core-js/promise"),s=n(o),l=e("babel-runtime/core-js/object/get-prototype-of"),u=n(l),c=e("babel-runtime/helpers/possibleConstructorReturn"),f=n(c),h=e("babel-runtime/helpers/inherits"),d=n(h),p=e("babel-runtime/helpers/slicedToArray"),m=n(p),_=e("babel-runtime/core-js/json/stringify"),g=n(_),v=e("babel-runtime/core-js/object/assign"),y=n(v),b=e("babel-runtime/core-js/get-iterator"),x=n(b),w=e("babel-runtime/core-js/set"),k=n(w),A=e("babel-runtime/helpers/toConsumableArray"),T=n(A),E=e("babel-runtime/helpers/classCallCheck"),S=n(E),R=e("babel-runtime/helpers/createClass"),j=n(R),M=e("../geo"),z=n(M),C=e("../utils/errors"),P=e("../utils/utils"),N=n(P),L=function(){function e(t,r){S.default(this,e),this.config=t,this.sources=r,this.id=t.id,this.name=t.name,this.pad_scale=t.pad_scale||1e-4,this.default_winding=null,this.rasters=Array.isArray(t.rasters)?[].concat(T.default(new k.default(t.rasters))):[],this.transform=t.transform,"function"==typeof this.transform&&this.transform.bind(this),this.extra_data=t.extra_data,this.scripts=t.scripts,this.max_zoom=null!=t.max_zoom?t.max_zoom:z.default.default_source_max_zoom,this.min_display_zoom=null!=t.min_display_zoom?t.min_display_zoom:0,this.max_display_zoom=null!=t.max_display_zoom?t.max_display_zoom:null}return j.default(e,[{key:"load",value:function(e){var t=this;return e.source_data={},e.source_data.layers={},e.pad_scale=this.pad_scale,e.rasters=[].concat(T.default(this.rasters)),this._load(e).then(function(e){for(var r in e.source_data.layers){var n=e.source_data.layers[r];n&&n.features&&n.features.forEach(function(e){z.default.transformGeometry(e.geometry,function(e){e[1]=-e[1],t.pad_scale&&(e[0]=Math.round(e[0]*(1+t.pad_scale)-z.default.tile_scale*t.pad_scale/2),e[1]=Math.round(e[1]*(1+t.pad_scale)-z.default.tile_scale*t.pad_scale/2))}),t.updateDefaultWinding(e.geometry)})}return e.default_winding=t.default_winding||"CCW",e})}},{key:"_load",value:function(){throw new C.MethodNotImplemented("_load")}},{key:"updateDefaultWinding",value:function(e){return null==this.default_winding&&("Polygon"===e.type?this.default_winding=z.default.ringWinding(e.coordinates[0]):"MultiPolygon"===e.type&&(this.default_winding=z.default.ringWinding(e.coordinates[0][0]))),this.default_winding}},{key:"includesTile",value:function(e,t){if(e.z<this.min_display_zoom||null!=this.max_display_zoom&&t>this.max_display_zoom)return!1;var r=!0,n=!1,i=void 0;try{for(var a,o=x.default(this.rasters);!(r=(a=o.next()).done);r=!0){var s=a.value;if(this.sources[s]&&this.sources[s]!==this&&!this.sources[s].includesTile(e,e.z))return!1}}catch(l){n=!0,i=l}finally{try{!r&&o.return&&o.return()}finally{if(n)throw i}}return!0}}],[{key:"create",value:function(t,r){return e.types[t.type]?new e.types[t.type](t,r):void 0}},{key:"changed",value:function(e,t){if(!e||!t)return!0;var r=y.default({},e.config,{id:null}),n=y.default({},t.config,{id:null});return g.default(r)!==g.default(n)}},{key:"projectData",value:function(e){var t=+new Date;for(var r in e.layers)for(var n=e.layers[r].features.length,i=0;n>i;i++){var a=e.layers[r].features[i];z.default.transformGeometry(a.geometry,function(e){var t=z.default.latLngToMeters(e),r=m.default(t,2),n=r[0],i=r[1];e[0]=n,e[1]=i})}void 0!==e.debug&&(e.debug.projection=+new Date-t)}},{key:"scaleData",value:function(e,t){var r=t.coords.z,n=t.min,i=(t.max,z.default.unitsPerMeter(r));for(var a in e.layers)for(var o=e.layers[a].features.length,s=0;o>s;s++){var l=e.layers[a].features[s];z.default.transformGeometry(l.geometry,function(e){e[0]=(e[0]-n.x)*i,e[1]=(e[1]-n.y)*i*-1})}}},{key:"register",value:function(t,r){t&&r&&(e.types[r]=t)}}]),e}();r.default=L,L.types={};{var O=r.NetworkSource=function(e){function t(e,r){S.default(this,t);var n=f.default(this,u.default(t).call(this,e,r));if(n.url=N.default.addParamsToURL(e.url,e.url_params),n.response_type="",null==n.url)throw Error("Network data source must provide a `url` property");return n}return d.default(t,e),j.default(t,[{key:"_load",value:function(e){var t=this,r=this.formatUrl(this.url,e),n=e.source_data;return n.url=r,e.debug=e.debug||{},e.debug.network=+new Date,new s.default(function(i){n.error=null;var a=N.default.io(r,6e4,t.response_type);n.request=a.request,a.then(function(r){e.debug.response_size=r.length||r.byteLength,e.debug.network=+new Date-e.debug.network,e.debug.parsing=+new Date,t.parseSourceData(e,n,r),e.debug.parsing=+new Date-e.debug.parsing,i(e)}).catch(function(t){n.error=t.stack,i(e)})})}},{key:"formatUrl",value:function(){throw new C.MethodNotImplemented("formatUrl")}},{key:"parseSourceData",value:function(){throw new C.MethodNotImplemented("parseSourceData")}}]),t}(L);r.NetworkTileSource=function(e){function t(e,r){S.default(this,t);var n=f.default(this,u.default(t).call(this,e,r));n.tiled=!0,n.parseBounds(e),n.builds_geometry_tiles=!1,n.tms=e.tms===!0,n.url_hosts=null;var i=n.url.match(/{s:\[([^}+]+)\]}/);return null!=i&&i.length>1&&(n.url_hosts=i[1].split(","),n.next_host=0),n}return d.default(t,e),j.default(t,[{key:"parseBounds",value:function(e){if(Array.isArray(e.bounds)&&4===e.bounds.length){this.bounds=e.bounds;var t=m.default(this.bounds,4),r=t[0],n=t[1],i=t[2],a=t[3];this.bounds_meters={min:z.default.latLngToMeters([r,a]),max:z.default.latLngToMeters([i,n])},this.bounds_tiles={min:{},max:{}}}}},{key:"checkBounds",value:function(e){if(this.bounds){e=z.default.wrapTile(e,{x:!0});var t=this.bounds_tiles.min[e.z];t||(t=this.bounds_tiles.min[e.z]=z.default.tileForMeters(this.bounds_meters.min,e.z));var r=this.bounds_tiles.max[e.z];if(r||(r=this.bounds_tiles.max[e.z]=z.default.tileForMeters(this.bounds_meters.max,e.z)),e.x<t.x||e.x>r.x||e.y<t.y||e.y>r.y)return!1}return!0}},{key:"includesTile",value:function(e,r){return a.default(u.default(t.prototype),"includesTile",this).call(this,e,r)&&this.checkBounds(e)?!0:!1}},{key:"formatUrl",value:function(e,t){var r=z.default.wrapTile(t.coords,{x:!0});this.tms&&(r.y=Math.pow(2,r.z)-1-r.y);var n=e.replace("{x}",r.x).replace("{y}",r.y).replace("{z}",r.z);return null!=this.url_hosts&&(n=n.replace(/{s:\[([^}+]+)\]}/,this.url_hosts[this.next_host]),this.next_host=(this.next_host+1)%this.url_hosts.length),n}},{key:"urlHasTilePattern",value:function(e){return e&&e.search("{x}")>-1&&e.search("{y}")>-1&&e.search("{z}")>-1}}]),t}(O)}},{"../geo":299,"../utils/errors":350,"../utils/utils":358,"babel-runtime/core-js/get-iterator":4,"babel-runtime/core-js/json/stringify":6,"babel-runtime/core-js/object/assign":9,"babel-runtime/core-js/object/get-prototype-of":14,"babel-runtime/core-js/promise":17,"babel-runtime/core-js/set":18,"babel-runtime/helpers/classCallCheck":21,"babel-runtime/helpers/createClass":22,"babel-runtime/helpers/get":24,"babel-runtime/helpers/inherits":25,"babel-runtime/helpers/possibleConstructorReturn":26,"babel-runtime/helpers/slicedToArray":27,"babel-runtime/helpers/toConsumableArray":28}],328:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function i(e,t,r){var n=S.default.centroid(e),i={};return o.default(i,t,r),{type:"Feature",properties:i,geometry:{type:"Point",coordinates:n}}}Object.defineProperty(r,"__esModule",{value:!0}),r.GeoJSONTileSource=r.GeoJSONSource=void 0;var a=e("babel-runtime/core-js/object/assign"),o=n(a),s=e("babel-runtime/core-js/get-iterator"),l=n(s),u=e("babel-runtime/core-js/object/get-prototype-of"),c=n(u),f=e("babel-runtime/helpers/classCallCheck"),h=n(f),d=e("babel-runtime/helpers/createClass"),p=n(d),m=e("babel-runtime/helpers/possibleConstructorReturn"),_=n(m),g=e("babel-runtime/helpers/get"),v=n(g),y=e("babel-runtime/helpers/inherits"),b=n(y),x=e("../utils/log"),w=n(x),k=e("./data_source"),A=n(k),T=e("./mvt"),E=e("../geo"),S=n(E),R=e("geojson-vt"),j=n(R),M=r.GeoJSONSource=function(e){function t(e,r){h.default(this,t);var n=_.default(this,c.default(t).call(this,e,r));return n.tiled=!0,n.load_data=null,n.tile_indexes={},n.max_zoom=Math.max(n.max_zoom||0,15),n.pad_scale=0,n}return b.default(t,e),p.default(t,[{key:"_load",value:function(e){var r=this;return this.load_data||(this.load_data=v.default(c.default(t.prototype),"_load",this).call(this,{source_data:{layers:{}}}).then(function(e){e.source_data.error&&w.default("warn","data source load error(s) for source '"+r.name+"', URL '"+r.url+"': "+e.source_data.error);var t=e.source_data.layers;for(var n in t)r.tile_indexes[n]=j.default(t[n],{maxZoom:r.max_zoom,tolerance:3,extent:S.default.tile_scale,buffer:1e-4});return r.loaded=!0,e})),this.load_data.then(function(){for(var t in r.tile_indexes)e.source_data.layers[t]=r.getTileFeatures(e,t);return e})}},{key:"getTileFeatures",value:function(e,t){var r=S.default.wrapTile(e.coords,{x:!0}),n=this.tile_indexes[t].getTile(r.z,r.x,r.y),i=void 0;if(n&&n.features){i={type:"FeatureCollection",features:[]};var a=!0,o=!1,s=void 0;try{for(var u,c=l.default(n.features);!(a=(u=c.next()).done);a=!0){var f=u.value,h={type:"Feature",geometry:{},properties:f.tags};if(1===f.type)h.geometry.coordinates=f.geometry.map(function(e){return[e[0],e[1]]}),h.geometry.type="MultiPoint";else{if(2!==f.type&&3!==f.type)continue;if(h.geometry.coordinates=f.geometry.map(function(e){return e.map(function(e){return[e[0],e[1]]})}),2===f.type)h.geometry.type="MultiLineString";else if(h.geometry=T.decodeMultiPolygon(h.geometry),null==h.geometry)continue}i.features.push(h)}}catch(d){o=!0,s=d}finally{try{!a&&c.return&&c.return()}finally{if(o)throw s}}}return i}},{key:"formatUrl",value:function(){return this.url}},{key:"parseSourceData",value:function(e,t,r){var n=JSON.parse(r),i=this.getLayers(n);this.preprocessLayers(i),t.layers=i}},{key:"preprocessLayers",value:function(e){for(var t in e){var r=e[t];this.preprocessFeatures(r.features)}}},{key:"preprocessFeatures",value:function(e){return this.config.generate_label_centroids&&!function(){var t=[],r={label_placement:!0};e.forEach(function(e){var n=void 0,a=void 0;switch(e.geometry.type){case"Polygon":n=e.geometry.coordinates,a=i(n,e.properties,r),t.push(a);break;case"MultiPolygon":n=e.geometry.coordinates;for(var o=-1/0,s=0,l=0;l<n.length;l++){var u=S.default.polygonArea(n[l]);u>o&&(o=u,s=l)}a=i(n[s],e.properties,r),t.push(a)}}),Array.prototype.push.apply(e,t)}(),e}},{key:"getLayers",value:function(e){return"Feature"===e.type?{_default:{type:"FeatureCollection",features:[e]}}:"FeatureCollection"===e.type?{_default:e}:e}}]),t}(k.NetworkSource),z=r.GeoJSONTileSource=function(e){function t(e,r){var n;h.default(this,t);var i=_.default(this,c.default(t).call(this,e,r));if(!i.urlHasTilePattern(i.url)){if("GeoJSON"===e.type){var a;return a=new M(e),_.default(i,a)}var o;return o=null,_.default(i,o)}return n=i,_.default(i,n)}return b.default(t,e),p.default(t,[{key:"parseSourceData",value:function(e,t,r){var n=JSON.parse(r);this.prepareGeoJSON(n,e,t)}},{key:"prepareGeoJSON",value:function(e,t,r){"function"==typeof this.transform&&(e=this.transform(e,this.extra_data)),r.layers=M.prototype.getLayers(e);var n={coords:t.coords,min:S.default.metersForTile(S.default.wrapTile(t.coords,{x:!0}))};A.default.projectData(r),A.default.scaleData(r,n)}}]),t}(k.NetworkTileSource);A.default.register(z,"GeoJSON")},{"../geo":299,"../utils/log":352,"./data_source":327,"./mvt":329,"babel-runtime/core-js/get-iterator":4,"babel-runtime/core-js/object/assign":9,"babel-runtime/core-js/object/get-prototype-of":14,"babel-runtime/helpers/classCallCheck":21,"babel-runtime/helpers/createClass":22,"babel-runtime/helpers/get":24,"babel-runtime/helpers/inherits":25,"babel-runtime/helpers/possibleConstructorReturn":26,"geojson-vt":172}],329:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function i(e){for(var t=[],r=[],n=void 0,i=0;i<e.coordinates.length;i++){var a=e.coordinates[i],o=v.default.ringWinding(a);null!=o&&(n=n||o,o===n&&r.length>0&&(t.push(r),r=[]),r.push(a))}return r.length>0&&t.push(r),1===t.length?(e.type="Polygon",e.coordinates=t[0]):t.length>1?(e.type="MultiPolygon",e.coordinates=t):e=null,e}Object.defineProperty(r,"__esModule",{value:!0}),r.MVTSource=void 0;var a=e("babel-runtime/core-js/object/get-prototype-of"),o=n(a),s=e("babel-runtime/helpers/classCallCheck"),l=n(s),u=e("babel-runtime/helpers/createClass"),c=n(u),f=e("babel-runtime/helpers/possibleConstructorReturn"),h=n(f),d=e("babel-runtime/helpers/inherits"),p=n(d);r.decodeMultiPolygon=i;var m=e("./data_source"),_=n(m),g=e("../geo"),v=n(g),y=e("pbf"),b=n(y),x=e("vector-tile"),w=r.MVTSource=function(e){function t(e,r){l.default(this,t);var n=h.default(this,o.default(t).call(this,e,r));return n.response_type="arraybuffer",n}return p.default(t,e),c.default(t,[{key:"parseSourceData",value:function(e,t,r){var n=new Uint8Array(r),i=new b.default(n);t.data=new x.VectorTile(i),t.layers=this.toGeoJSON(t.data),delete t.data}},{key:"toGeoJSON",value:function(e){var t={};for(var r in e.layers){for(var n=e.layers[r],a={type:"FeatureCollection",features:[]},o=0;o<n.length;o++){for(var s=n.feature(o),l={type:"Feature",geometry:{},properties:s.properties},u=l.geometry,c=s.loadGeometry(),f=0;f<c.length;f++)for(var h=c[f],d=0;d<h.length;d++)h[d]=[h[d].x,h[d].y];u.coordinates=c,"Point"===x.VectorTileFeature.types[s.type]?(u.type="Point",u.coordinates=u.coordinates[0][0]):"LineString"===x.VectorTileFeature.types[s.type]?1===c.length?(u.type="LineString",u.coordinates=u.coordinates[0]):u.type="MultiLineString":"Polygon"===x.VectorTileFeature.types[s.type]&&(u=i(u)),a.features.push(l)}t[r]=a}return t}}]),t}(m.NetworkTileSource);_.default.register(w,"MVT")},{"../geo":299,"./data_source":327,"babel-runtime/core-js/object/get-prototype-of":14,"babel-runtime/helpers/classCallCheck":21,"babel-runtime/helpers/createClass":22,"babel-runtime/helpers/inherits":25,"babel-runtime/helpers/possibleConstructorReturn":26,pbf:276,"vector-tile":290}],330:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(r,"__esModule",{value:!0}),r.RasterTileSource=void 0;var i=e("babel-runtime/core-js/promise"),a=n(i),o=e("babel-runtime/helpers/toConsumableArray"),s=n(o),l=e("babel-runtime/core-js/object/get-prototype-of"),u=n(l),c=e("babel-runtime/helpers/classCallCheck"),f=n(c),h=e("babel-runtime/helpers/createClass"),d=n(h),p=e("babel-runtime/helpers/possibleConstructorReturn"),m=n(p),_=e("babel-runtime/helpers/inherits"),g=n(_),v=e("./data_source"),y=n(v),b=e("../tile"),x=n(b),w=e("../geo"),k=n(w),A=r.RasterTileSource=function(e){function t(e,r){f.default(this,t);var n=m.default(this,u.default(t).call(this,e,r));return-1===n.rasters.indexOf(n.name)&&n.rasters.unshift(n.name),n.filtering=e.filtering,n.textures={},n}return g.default(t,e),d.default(t,[{key:"load",value:function(e){e.source_data={},e.source_data.layers={},e.pad_scale=this.pad_scale,e.rasters=[].concat(s.default(this.rasters));var t=k.default.tile_scale;return e.source_data.layers={_default:{type:"FeatureCollection",features:[{geometry:{type:"Polygon",coordinates:[[[0,0],[t,0],[t,-t],[0,-t],[0,0]]]},properties:{}}]}},e.default_winding="CW",a.default.resolve(e)}},{key:"tileTexture",value:function(e){var t=e.coords.key;if(!this.textures[t]){var r=x.default.coordinateWithMaxZoom(e.coords,this.max_zoom),n=this.formatUrl(this.url,{coords:r});this.textures[t]={url:n,filtering:this.filtering,coords:r}}return this.textures[t]}}]),t}(v.NetworkTileSource);y.default.register(A,"Raster")},{"../geo":299,"../tile":346,"./data_source":327,"babel-runtime/core-js/object/get-prototype-of":14,"babel-runtime/core-js/promise":17,"babel-runtime/helpers/classCallCheck":21,"babel-runtime/helpers/createClass":22,"babel-runtime/helpers/inherits":25,"babel-runtime/helpers/possibleConstructorReturn":26,"babel-runtime/helpers/toConsumableArray":28}],331:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function i(e,t){var r=k.default.feature(e,t);return"Feature"===r.type&&(r={type:"FeatureCollection",features:[r]}),r}Object.defineProperty(r,"__esModule",{value:!0}),r.TopoJSONTileSource=r.TopoJSONSource=void 0;var a=e("babel-runtime/core-js/object/keys"),o=n(a),s=e("babel-runtime/core-js/object/get-prototype-of"),l=n(s),u=e("babel-runtime/helpers/classCallCheck"),c=n(u),f=e("babel-runtime/helpers/createClass"),h=n(f),d=e("babel-runtime/helpers/possibleConstructorReturn"),p=n(d),m=e("babel-runtime/helpers/get"),_=n(m),g=e("babel-runtime/helpers/inherits"),v=n(g),y=e("./data_source"),b=n(y),x=e("./geojson"),w=e("topojson"),k=n(w),A=r.TopoJSONSource=function(e){function t(){return c.default(this,t),p.default(this,l.default(t).apply(this,arguments))}return v.default(t,e),h.default(t,[{key:"parseSourceData",value:function(e,r,n){var i=JSON.parse(n);i=this.toGeoJSON(i);var a=this.getLayers(i);_.default(l.default(t.prototype),"preprocessLayers",this).call(this,a),r.layers=a}},{key:"toGeoJSON",value:function(e){if(e.objects&&1===o.default(e.objects).length){var t=o.default(e.objects)[0];e=i(e,e.objects[t])}else{var r={};for(var n in e.objects)r[n]=i(e,e.objects[n]);e=r}return e}}]),t}(x.GeoJSONSource),T=r.TopoJSONTileSource=function(e){function t(e,r){c.default(this,t);var n=p.default(this,l.default(t).call(this,e,r));if(!n.urlHasTilePattern(n.url)){var i;return i=new A(e),p.default(n,i)}return n}return v.default(t,e),h.default(t,[{key:"parseSourceData",value:function(e,t,r){var n=JSON.parse(r);n=A.prototype.toGeoJSON(n),this.prepareGeoJSON(n,e,t)}}]),t}(x.GeoJSONTileSource);b.default.register(T,"TopoJSON")},{"./data_source":327,"./geojson":328,"babel-runtime/core-js/object/get-prototype-of":14,"babel-runtime/core-js/object/keys":15,"babel-runtime/helpers/classCallCheck":21,"babel-runtime/helpers/createClass":22,"babel-runtime/helpers/get":24,"babel-runtime/helpers/inherits":25,"babel-runtime/helpers/possibleConstructorReturn":26,topojson:284}],332:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function i(e){if(e.length>1){for(var t=e[0],r=1;r<e.length;r++)t+="/"+e[r];return t}return e[0]}function a(e,t){for(var r=void 0,n=0,i={visible:!0},a=0;a<e.length;a++)e[a].length>n&&(n=e[a].length);if(0===n)return null;for(var o=function(n){return r=e.map(function(e){return e[n]&&e[n][t]}),0===r.length?"continue":(r.sort(function(e,t){return(e&&e.layer_name)>(t&&t.layer_name)?1:-1}),B.default.apply(void 0,[i].concat(N.default(r))),void delete i.layer_name)},s=0;n>s;s++){{o(s)}}return i.visible===!1?null:i}function o(e){return V.indexOf(e)>-1}function s(e){return 0===E.default(e).length}function l(e){var t={},r={};for(var n in e)o(n)?t[n]=e[n]:r[n]=e[n];return[t,r]}function u(e){var t=[];if(e.parent){var r=e.parent.calculatedDraw||[];t.push.apply(t,N.default(r))}return t.push(e.draw),t}function c(e,t,r,n){var i={name:e,layer:t,parent:r},a=l(t),o=_.default(a,2),u=o[0],f=o[1],h=s(f),d=void 0;d=h&&null!=r?H:X;var m=new d(p.default(i,u));if(r&&r.addLayer(m),!h)for(var g in f){var v=f[g];if("object"!==("undefined"==typeof v?"undefined":R.default(v))||Array.isArray(v)){var y="Layer value must be an object: cannot create layer '"+g+": "+A.default(v)+"'";y+=", under parent layer '"+m.full_name+"'.",n[m.name]&&(y+=" The parent name '"+m.name+"' is also the name of a style, did you mean to create a 'draw' group",r&&(y+=" under '"+r.name+"'"),y+=" instead?"),U.default("warn",y)}else c(g,v,m,n)}return m}function f(e,t){var r={};for(var n in e){var i=e[n];i&&(r[n]=c(n,i,null,t))}return r}function h(e,t,r,n){var i=!1,a=!1;if(0!==t.length){for(var o=0;o<t.length;o++){var s=t[o];s.is_leaf?s.doesMatch(e)&&(i=!0,r.push(s),n.push(s.id)):s.is_tree&&s.doesMatch(e)&&(i=!0,a=h(e,s.layers,r,n),a||(r.push(s),n.push(s.id)))}return i}}Object.defineProperty(r,"__esModule",{value:!0}),r.LayerTree=r.LayerLeaf=r.layer_cache=r.whiteList=void 0;var d=e("babel-runtime/core-js/object/assign"),p=n(d),m=e("babel-runtime/helpers/slicedToArray"),_=n(m),g=e("babel-runtime/core-js/object/get-prototype-of"),v=n(g),y=e("babel-runtime/helpers/possibleConstructorReturn"),b=n(y),x=e("babel-runtime/helpers/inherits"),w=n(x),k=e("babel-runtime/core-js/json/stringify"),A=n(k),T=e("babel-runtime/core-js/object/keys"),E=n(T),S=e("babel-runtime/helpers/typeof"),R=n(S),j=e("babel-runtime/helpers/classCallCheck"),M=n(j),z=e("babel-runtime/helpers/createClass"),C=n(z),P=e("babel-runtime/helpers/toConsumableArray"),N=n(P);r.mergeTrees=a,r.groupProps=l,r.calculateDraw=u,r.parseLayerTree=c,r.parseLayers=f,r.matchFeature=h;var L=e("./style_parser"),O=e("../utils/utils"),I=n(O),F=e("../utils/log"),U=n(F),D=e("../utils/merge"),B=n(D),G=e("match-feature"),V=r.whiteList=["filter","draw","visible","data"],W=r.layer_cache={},q=["any","all","not","none"],Z=function(){function e(t){var r=t.layer,n=t.name,i=t.parent,a=t.draw,o=t.visible,s=t.filter;if(M.default(this,e),this.id=e.id++,this.config=r,this.parent=i,this.name=n,this.full_name=this.parent?this.parent.full_name+":"+this.name:this.name,this.draw=a,this.filter=s,this.is_built=!1,this.visible=void 0!==o?o:this.parent&&this.parent.visible,this.draw)for(var l in this.draw)if(null==this.draw[l]||"object"!==R.default(this.draw[l])){var u="Draw group '"+l+"' for layer "+this.full_name+" is invalid, must be an object, ";u+="but was set to `"+l+": "+this.draw[l]+"` instead",U.default("warn",u),delete this.draw[l]}else this.draw[l].layer_name=this.full_name}return C.default(e,[{key:"build",value:function(){U.default("trace","Building layer '"+this.full_name+"'"),this.buildFilter(),this.buildDraw(),this.is_built=!0}},{key:"buildDraw",value:function(){this.draw=I.default.stringsToFunctions(this.draw,L.StyleParser.wrapFunction),this.calculatedDraw=u(this)}},{key:"buildFilter",value:function(){this.filter_original=this.filter,this.filter=I.default.stringsToFunctions(this.filter,L.StyleParser.wrapFunction);var e=R.default(this.filter);if(null!=this.filter&&"object"!==e&&"function"!==e){var t="Filter for layer "+this.full_name+" is invalid, filter value must be an object or function, ";return t+="but was set to `filter: "+this.filter+"` instead",void U.default("warn",t)}try{this.buildZooms(),this.buildPropMatches(),this.filter=null!=this.filter&&("function"==typeof this.filter||E.default(this.filter).length>0)?G.match(this.filter,Y):null}catch(r){var n="Filter for layer "+this.full_name+" is invalid, `filter: "+A.default(this.filter)+"` ";n+="failed with error '"+r.message+"', stack trace: "+r.stack,U.default("warn",n)}}},{key:"buildZooms",value:function(){var e=this.filter&&this.filter.$zoom,t="undefined"==typeof e?"undefined":R.default(e);if(null!=e&&"function"!==t){if(this.zooms={},"number"===t)this.zooms[e]=!0;else if(Array.isArray(e))for(var r=0;r<e.length;r++)this.zooms[e[r]]=!0;else if("object"===t&&(null!=e.min||null!=e.max))for(var n=e.min||0,i=e.max||25,a=n;i>a;a++)this.zooms[a]=!0;delete this.filter.$zoom}}},{key:"buildPropMatches",value:function(){var e=this;this.filter&&!Array.isArray(this.filter)&&"function"!=typeof this.filter&&E.default(this.filter).forEach(function(t){if(-1===q.indexOf(t)){var r=e.filter[t],n="undefined"==typeof r?"undefined":R.default(r),i=Array.isArray(r);if(!i&&"string"!==n&&"number"!==n)return;"$"===t[0]?(e.context_prop_matches=e.context_prop_matches||[],e.context_prop_matches.push([t.substring(1),i?r:[r]])):(e.feature_prop_matches=e.feature_prop_matches||[],e.feature_prop_matches.push([t,i?r:[r]])),delete e.filter[t]}})}},{key:"doPropMatches",value:function(e){if(this.feature_prop_matches)for(var t=0;t<this.feature_prop_matches.length;t++){var r=this.feature_prop_matches[t],n=e.feature.properties[r[0]];if(null==n||-1===r[1].indexOf(n))return!1}if(this.context_prop_matches)for(var i=0;i<this.context_prop_matches.length;i++){var a=this.context_prop_matches[i],o=e[a[0]];if(null==o||-1===a[1].indexOf(o))return!1}return!0}},{key:"doesMatch",value:function(e){if(this.is_built||this.build(),null!=this.zooms&&!this.zooms[e.zoom])return!1;if(!this.doPropMatches(e))return!1;if(!(this.filter instanceof Function))return null==this.filter;try{return this.filter(e)}catch(t){var r="Filter for this "+this.full_name+": `filter: "+this.filter_original+"` ";r+="failed with error '"+t.message+"', stack trace: "+t.stack,U.default("error",r,e.feature)}}}]),e}();Z.id=0;var H=r.LayerLeaf=function(e){function t(e){M.default(this,t);var r=b.default(this,v.default(t).call(this,e));return r.is_leaf=!0,r}return w.default(t,e),t}(Z),X=r.LayerTree=function(e){function t(e){M.default(this,t);var r=b.default(this,v.default(t).call(this,e));return r.is_tree=!0,r.layers=e.layers||[],r}return w.default(t,e),C.default(t,[{key:"addLayer",value:function(e){this.layers.push(e)}},{key:"buildDrawGroups",value:function(e){var t=[],r=[];if(h(e,[this],t,r),t.length>0){var n=i(r);if(void 0===W[n]){for(var o=t.map(function(e){return e&&e.visible!==!1&&e.calculatedDraw}),s={},l=0;l<o.length;l++){var u=o[l];if(u)for(var c=0;c<u.length;c++){var f=u[c];for(var d in f)s[d]=!0}}for(var p in s)W[n]=W[n]||{},W[n][p]=a(o,p),W[n][p]?(W[n][p].key=n+"/"+p,W[n][p].layers=t.map(function(e){return e&&e.full_name})):delete W[n][p];W[n]&&0===E.default(W[n]).length&&(W[n]=null)}return W[n]}}}]),t}(Z),Y={rangeTransform:function(e){return"string"==typeof e&&"px2"===e.trim().slice(-3)?parseFloat(e)+" * context.meters_per_pixel_sq":e}}},{"../utils/log":352,"../utils/merge":354,"../utils/utils":358,"./style_parser":340,"babel-runtime/core-js/json/stringify":6,"babel-runtime/core-js/object/assign":9,"babel-runtime/core-js/object/get-prototype-of":14,"babel-runtime/core-js/object/keys":15,"babel-runtime/helpers/classCallCheck":21,"babel-runtime/helpers/createClass":22,"babel-runtime/helpers/inherits":25,"babel-runtime/helpers/possibleConstructorReturn":26,"babel-runtime/helpers/slicedToArray":27,"babel-runtime/helpers/toConsumableArray":28,"babel-runtime/helpers/typeof":29,"match-feature":258}],333:[function(e,t,r){"use strict";function n(e){var t=arguments.length<=1||void 0===arguments[1]?{}:arguments[1],r=t.dash_color||i,n=t.background_color||a,o=e,s=t.scale||1;o.length%2===1&&Array.prototype.push.apply(o,o);for(var l=!0,u=[],c=0;c<o.length;c++){for(var f=Math.floor(o[c]*s),h=0;f>h;h++)Array.prototype.push.apply(u,l?r:n);l=!l}u=new Uint8Array(u);var d=u.length/4;return{pixels:u,length:d}}Object.defineProperty(r,"__esModule",{value:!0}),r.default=n;var i=[255,255,255,255],a=[0,0,0,0]},{}],334:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(r,"__esModule",{value:!0}),r.Lines=void 0;var i=e("babel-runtime/core-js/object/assign"),a=n(i),o=e("babel-runtime/core-js/object/create"),s=n(o),l=e("../style"),u=e("../style_parser"),c=e("../../gl/constants"),f=n(c),h=e("../../gl/texture"),d=n(h),p=e("../../gl/vertex_layout"),m=n(p),_=e("../../builders/polylines"),g=e("./dasharray"),v=n(g),y=e("../../geo"),b=n(y),x=e("../polygons/polygons"),w=r.Lines=s.default(l.Style);a.default(w,{name:"lines",built_in:!0,vertex_shader_src:x.shaderSrc_polygonsVertex,fragment_shader_src:x.shaderSrc_polygonsFragment,selection:!0,init:function(){l.Style.init.apply(this,arguments);var e=[{name:"a_position",size:4,type:f.default.SHORT,normalized:!1},{name:"a_extrude",size:4,type:f.default.SHORT,normalized:!1},{name:"a_color",size:4,type:f.default.UNSIGNED_BYTE,normalized:!0}];this.defines.TANGRAM_LAYER_ORDER=!0,this.defines.TANGRAM_EXTRUDE_LINES=!0,this.selection&&e.push({name:"a_selection_color",size:4,type:f.default.UNSIGNED_BYTE,normalized:!0}),(this.texture||this.dash)&&(this.texcoords=!0),this.texcoords&&(this.defines.TANGRAM_TEXTURE_COORDS=!0,this.defines.TANGRAM_DASH_SCALE=1,this.defines.TANGRAM_V_SCALE_ADJUST=b.default.tile_scale*this.defines.TANGRAM_DASH_SCALE,e.push({name:"a_texcoord",size:2,type:f.default.UNSIGNED_SHORT,normalized:!0})),this.vertex_layout=new m.default(e),this.outline_feature_style={},this.inline_feature_style=this.feature_style},compile:function(){return this.parseLineTexture(),l.Style.compile.apply(this,arguments)},parseLineTexture:function(){var e=this;if(this.dash){this.dash_background_color&&(this.dash_background_color=u.StyleParser.parseColor(this.dash_background_color),this.defines.TANGRAM_LINE_BACKGROUND_COLOR="vec3("+this.dash_background_color.slice(0,3).join(", ")+")"),this.defines.TANGRAM_DASH_SCALE=20,this.defines.TANGRAM_V_SCALE_ADJUST=b.default.tile_scale*this.defines.TANGRAM_DASH_SCALE;var t=v.default(this.dash,{scale:this.defines.TANGRAM_DASH_SCALE});this.texture="_"+this.name+"_dasharray",d.default.create(this.gl,this.texture,{data:t.pixels,height:t.length,width:1,filtering:"nearest"})}this.texture&&(this.defines.TANGRAM_LINE_TEXTURE=!0,this.defines.TANGRAM_ALPHA_TEST=.5,this.shaders.uniforms=this.shaders.uniforms||{},this.shaders.uniforms.u_texture=this.texture,this.shaders.uniforms.u_texture_ratio=1,d.default.getInfo(this.texture).then(function(t){t&&(e.shaders.uniforms.u_texture_ratio=t.height/t.width)}))},calcWidth:function(e,t){return e&&u.StyleParser.evalCachedDistanceProperty(e,t)||0},calcWidthNextZoom:function(e,t){t.zoom++;var r=this.calcWidth(e,t);return t.zoom--,r},_parseFeature:function(e,t,r){var n=this.feature_style,i=this.calcWidth(t.width,r);if(!(0>i)){var a=this.calcWidthNextZoom(t.next_width,r);if(!(0===i&&0===a||0>a)&&(n.width=i*r.units_per_meter_overzoom,n.next_width=2*a-i,n.next_width*=r.units_per_meter_overzoom,n.next_width/=2,n.color=this.parseColor(t.color,r),n.color)){if(n.z=t.z&&u.StyleParser.evalCachedDistanceProperty(t.z||0,r)||u.StyleParser.defaults.z,n.height=e.properties.height||u.StyleParser.defaults.height,n.extrude=u.StyleParser.evalProperty(t.extrude,r),n.extrude&&("number"==typeof n.extrude?n.height=n.extrude:Array.isArray(n.extrude)&&(n.height=n.extrude[1])),n.extrude&&n.height&&(n.z+=n.height),n.z*=b.default.height_scale,n.height*=b.default.height_scale,n.cap=t.cap,n.join=t.join,n.miter_limit=t.miter_limit,n.tile_edges=t.tile_edges,n.outline=n.outline||{width:{},next_width:{},preprocessed:!0},t.outline&&t.outline.visible!==!1&&t.outline.color&&t.outline.width){var o=2*this.calcWidth(t.outline.width,r),s=2*this.calcWidthNextZoom(t.outline.next_width,r); 16 0===o&&0===s||0>o||0>s?(n.outline.width.value=null,n.outline.next_width.value=null,n.outline.color=null):(n.outline.width.value=o+i,n.outline.next_width.value=s+a,n.outline.color=t.outline.color,n.outline.cap=t.outline.cap||t.cap,n.outline.join=t.outline.join||t.join,n.outline.miter_limit=t.outline.miter_limit||t.miter_limit,n.outline.style=t.outline.style||this.name,n.outline.order=t.outline.order?this.parseOrder(t.outline.order,r):n.order,n.outline.order>n.order&&(n.outline.order=n.order),n.outline.order-=.5)}else n.outline.width.value=null,n.outline.next_width.value=null,n.outline.color=null;return n}}},_preprocess:function(e){return e.color=u.StyleParser.createColorPropertyCache(e.color),e.width=u.StyleParser.createPropertyCache(e.width,u.StyleParser.parseUnits),e.next_width=u.StyleParser.createPropertyCache(e.width,u.StyleParser.parseUnits),e.z=u.StyleParser.createPropertyCache(e.z,u.StyleParser.parseUnits),e.outline&&(e.outline.color=u.StyleParser.createColorPropertyCache(e.outline.color),e.outline.width=u.StyleParser.createPropertyCache(e.outline.width,u.StyleParser.parseUnits),e.outline.next_width=u.StyleParser.createPropertyCache(e.outline.width,u.StyleParser.parseUnits)),e},makeVertexTemplate:function(e){var t=0;return this.vertex_template[t++]=0,this.vertex_template[t++]=0,this.vertex_template[t++]=e.z||0,this.vertex_template[t++]=this.scaleOrder(e.order),this.vertex_template[t++]=0,this.vertex_template[t++]=0,this.vertex_template[t++]=0,this.vertex_template[t++]=e.next_width,this.vertex_template[t++]=255*e.color[0],this.vertex_template[t++]=255*e.color[1],this.vertex_template[t++]=255*e.color[2],this.vertex_template[t++]=255*e.color[3],this.selection&&(this.vertex_template[t++]=255*e.selection_color[0],this.vertex_template[t++]=255*e.selection_color[1],this.vertex_template[t++]=255*e.selection_color[2],this.vertex_template[t++]=255*e.selection_color[3]),this.texcoords&&(this.vertex_template[t++]=0,this.vertex_template[t++]=0),this.vertex_template},buildLines:function(e,t,r,n,i){if(this.feature_style=this.outline_feature_style,t.outline&&null!=t.outline.color&&null!=t.outline.width.value){var a=this.styles[t.outline.style];a&&a.addFeature(n.feature,t.outline,n)}this.feature_style=this.inline_feature_style;var o=this.makeVertexTemplate(t);_.buildPolylines(e,t.width,r,o,{cap:t.cap,join:t.join,miter_limit:t.miter_limit,scaling_index:this.vertex_layout.index.a_extrude,scaling_normalize:256,texcoord_index:this.vertex_layout.index.a_texcoord,texcoord_width:(t.width||t.next_width)/n.tile.overzoom2,texcoord_normalize:65535,closed_polygon:i&&i.closed_polygon,remove_tile_edges:!t.tile_edges&&i&&i.remove_tile_edges,tile_edge_tolerance:b.default.tile_scale*n.tile.pad_scale*4})},buildPolygons:function(e,t,r,n){for(var i=0;i<e.length;i++)this.buildLines(e[i],t,r,n,{closed_polygon:!0,remove_tile_edges:!0})}})},{"../../builders/polylines":297,"../../geo":299,"../../gl/constants":300,"../../gl/texture":306,"../../gl/vertex_layout":311,"../polygons/polygons":336,"../style":338,"../style_parser":340,"./dasharray":333,"babel-runtime/core-js/object/assign":9,"babel-runtime/core-js/object/create":10}],335:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(r,"__esModule",{value:!0}),r.Points=void 0;var i=e("babel-runtime/helpers/slicedToArray"),a=n(i),o=e("babel-runtime/core-js/promise"),s=n(o),l=e("babel-runtime/core-js/object/assign"),u=n(l),c=e("babel-runtime/core-js/object/create"),f=n(c),h=e("../../utils/log"),d=n(h),p=e("../style"),m=e("../style_parser"),_=e("../../gl/constants"),g=n(_),v=e("../../gl/vertex_layout"),y=n(v),b=e("../../builders/points"),x=e("../../gl/texture"),w=n(x),k=e("../../geo"),A=n(k),T=e("../../vector"),E=n(T),S=e("../../labels/collision"),R=n(S),j=e("../../labels/label_point"),M=n(j),z=e("../text/text_labels"),C=e("../../utils/debug_settings"),P=n(C),N="uniform vec2 u_resolution;\nuniform float u_time;\nuniform vec3 u_map_position;\nuniform vec4 u_tile_origin;\nuniform float u_tile_proxy_depth;\nuniform float u_meters_per_pixel;\nuniform float u_device_pixel_ratio;\nuniform float u_visible_time;\nuniform bool u_fade_in;\n\nuniform mat4 u_model;\nuniform mat4 u_modelView;\nuniform mat3 u_normalMatrix;\nuniform mat3 u_inverseNormalMatrix;\n\nattribute vec4 a_position;\nattribute vec4 a_shape;\nattribute vec4 a_color;\nattribute vec2 a_texcoord;\nattribute vec2 a_offset;\n\n#define TANGRAM_NORMAL vec3(0., 0., 1.)\n\nvarying vec4 v_color;\nvarying vec2 v_texcoord;\nvarying vec4 v_world_position;\n\n#ifdef TANGRAM_MULTI_SAMPLER\nvarying float v_sampler;\n#endif\n\n#pragma tangram: camera\n#pragma tangram: material\n#pragma tangram: lighting\n#pragma tangram: raster\n#pragma tangram: global\n\nvec2 rotate2D(vec2 _st, float _angle) {\n return mat2(cos(_angle),-sin(_angle),\n sin(_angle),cos(_angle)) * _st;\n}\n\nvoid main() {\n // Initialize globals\n #pragma tangram: setup\n\n v_color = a_color;\n v_texcoord = a_texcoord;\n\n // Position\n vec4 position = u_modelView * vec4(a_position.xyz, 1.);\n\n // Apply positioning and scaling in screen space\n vec2 shape = a_shape.xy / 256.; // values have an 8-bit fraction\n vec2 offset = vec2(a_offset.x, -a_offset.y); // flip y to make it point down\n float theta = a_shape.z / 4096.; // values have a 12-bit fraction\n\n #ifdef TANGRAM_MULTI_SAMPLER\n v_sampler = a_shape.w; // texture sampler\n #endif\n\n shape = rotate2D(shape, theta); // apply rotation to vertex\n shape += rotate2D(offset, theta); // apply offset on rotated axis (e.g. so line labels follow text axis)\n\n // World coordinates for 3d procedural textures\n v_world_position = u_model * position;\n v_world_position.xy += shape * u_meters_per_pixel;\n v_world_position = wrapWorldPosition(v_world_position);\n\n // Modify position before camera projection\n #pragma tangram: position\n\n cameraProjection(position);\n\n #ifdef TANGRAM_LAYER_ORDER\n // +1 is to keep all layers including proxies > 0\n applyLayerOrder(a_position.w + u_tile_proxy_depth + 1., position);\n #endif\n\n // Apply pixel offset in screen-space\n // Multiply by 2 is because screen is 2 units wide Normalized Device Coords (and u_resolution device pixels wide)\n // Device pixel ratio adjustment is because shape is in logical pixels\n position.xy += shape * position.w * 2. * u_device_pixel_ratio / u_resolution;\n\n gl_Position = position;\n}\n",L="uniform vec2 u_resolution;\nuniform float u_time;\nuniform vec3 u_map_position;\nuniform vec4 u_tile_origin;\nuniform float u_meters_per_pixel;\nuniform float u_device_pixel_ratio;\nuniform float u_visible_time;\nuniform bool u_fade_in;\n\nuniform mat3 u_normalMatrix;\nuniform mat3 u_inverseNormalMatrix;\n\nuniform sampler2D u_texture;\n\n#ifdef TANGRAM_MULTI_SAMPLER\nuniform sampler2D u_label_texture;\nvarying float v_sampler;\n#endif\n\nvarying vec4 v_color;\nvarying vec2 v_texcoord;\nvarying vec4 v_world_position;\n\n#define TANGRAM_NORMAL vec3(0., 0., 1.)\n\n// Alpha discard threshold (substitute for alpha blending)\n#ifndef TANGRAM_ALPHA_TEST\n#define TANGRAM_ALPHA_TEST 0.5\n#endif\n\n// Alpha fade range for edges of points\n#ifndef TANGRAM_FADE_RANGE\n#define TANGRAM_FADE_RANGE .15\n#endif\n#define TANGRAM_FADE_START (1. - TANGRAM_FADE_RANGE)\n\n#pragma tangram: camera\n#pragma tangram: material\n#pragma tangram: lighting\n#pragma tangram: raster\n#pragma tangram: global\n\nvoid main (void) {\n // Initialize globals\n #pragma tangram: setup\n\n vec4 color = v_color;\n\n #ifdef TANGRAM_MULTI_SAMPLER\n if (v_sampler == 0.) { // sprite sampler\n #endif\n #ifdef TANGRAM_POINT_TEXTURE\n // Draw sprite\n color *= texture2D(u_texture, v_texcoord);\n #else\n // Draw a point\n vec2 uv = v_texcoord * 2. - 1.; // fade alpha near circle edge\n float point_dist = length(uv);\n color.a = clamp(color.a - (smoothstep(0., TANGRAM_FADE_RANGE, (point_dist - TANGRAM_FADE_START)) / TANGRAM_FADE_RANGE), 0., color.a);\n #endif\n #ifdef TANGRAM_MULTI_SAMPLER\n }\n else { // label sampler\n color = texture2D(u_label_texture, v_texcoord);\n color.rgb /= max(color.a, 0.001); // un-multiply canvas texture\n }\n #endif\n\n // Manually un-multiply alpha, for cases where texture has pre-multiplied alpha\n #ifdef TANGRAM_UNMULTIPLY_ALPHA\n color.rgb /= max(color.a, 0.001);\n #endif\n\n // If blending is off, use alpha discard as a lower-quality substitute\n #if !defined(TANGRAM_BLEND_OVERLAY) && !defined(TANGRAM_BLEND_INLAY)\n if (color.a < TANGRAM_ALPHA_TEST) {\n discard;\n }\n #endif\n\n #pragma tangram: color\n\n // Fade in (if requested) based on time mesh has been visible\n #ifdef TANGRAM_FADE_IN_RATE\n if (u_fade_in) {\n color.a *= clamp(u_visible_time * TANGRAM_FADE_IN_RATE, 0., 1.);\n }\n #endif\n\n // Fade out when tile is zooming out, e.g. acting as proxy tiles\n // NB: this is mostly done to compensate for text label collision happening at the label's 1x zoom. As labels\n // in proxy tiles are scaled down, they begin to overlap, and the fade is a simple way to ease the transition.\n #ifdef TANGRAM_FADE_ON_ZOOM_OUT\n color.a *= clamp(1. - TANGRAM_FADE_ON_ZOOM_OUT_RATE * (u_tile_origin.z - u_map_position.z), 0., 1.);\n #endif\n\n #pragma tangram: filter\n\n gl_FragColor = color;\n}\n",O=r.Points=f.default(p.Style);u.default(O,z.TextLabels),u.default(O,{name:"points",built_in:!0,selection:!0,collision:!0,blend:"overlay",init:function(){arguments.length<=0||void 0===arguments[0]?{}:arguments[0];p.Style.init.apply(this,arguments),this.vertex_shader_src=N,this.fragment_shader_src=L;var e=[{name:"a_position",size:4,type:g.default.SHORT,normalized:!1},{name:"a_shape",size:4,type:g.default.SHORT,normalized:!1},{name:"a_texcoord",size:2,type:g.default.UNSIGNED_SHORT,normalized:!0},{name:"a_offset",size:2,type:g.default.SHORT,normalized:!1},{name:"a_color",size:4,type:g.default.UNSIGNED_BYTE,normalized:!0}];this.selection&&e.push({name:"a_selection_color",size:4,type:g.default.UNSIGNED_BYTE,normalized:!0}),this.vertex_layout=new y.default(e),"overlay"!==this.blend&&(this.defines.TANGRAM_LAYER_ORDER=!0),this.shaders.uniforms=this.shaders.uniforms||{},this.shaders.uniforms.u_label_texture=w.default.default,this.texture&&(this.defines.TANGRAM_POINT_TEXTURE=!0,this.shaders.uniforms.u_texture=this.texture),this.defines.TANGRAM_MULTI_SAMPLER=!0,this.defines.TANGRAM_FADE_ON_ZOOM_OUT=!0,this.defines.TANGRAM_FADE_ON_ZOOM_OUT_RATE=2,P.default.suppress_label_fade_in===!0?(this.fade_in_time=0,this.defines.TANGRAM_FADE_IN_RATE=null):(this.fade_in_time=.15,this.defines.TANGRAM_FADE_IN_RATE=1/this.fade_in_time),this.collision_group_points=this.name+"-points",this.collision_group_text=this.name+"-text",this.reset()},reset:function(){this.queues={},this.resetText(),this.texture_missing_sprites={}},addFeature:function(e,t,r){var n=r.tile;if(n.generation===this.generation&&(t=this.preprocess(t))){var i={};if(i.color=this.parseColor(t.color,r),!i.color&&!this.texture)return null;var a=i.sprite=m.StyleParser.evalProperty(t.sprite,r);if(i.sprite_default=t.sprite_default,this.texture&&w.default.textures[this.texture]&&w.default.textures[this.texture].sprites){if(!a&&!i.sprite_default)return;if(!w.default.textures[this.texture].sprites[a]){if(!i.sprite_default)return void(this.texture_missing_sprites[a]||(d.default("debug","Style: in style '"+this.name+"', could not find sprite '"+a+"' for texture '"+this.texture+"'"),this.texture_missing_sprites[a]=!0));if(a=i.sprite_default,!w.default.textures[this.texture].sprites[a])return void d.default("warn","Style: in style '"+this.name+"', could not find default sprite '"+a+"' for texture '"+this.texture+"'")}}else a&&(d.default("warn","Style: in style '"+this.name+"', sprite '"+a+"' was specified, but texture '"+this.texture+"' has no sprites"),a=null);var o=void 0;this.texture&&a?(o=w.default.getSpriteInfo(this.texture,a),i.texcoords=o.texcoords):i.texcoords=null,i.z=t.z&&m.StyleParser.evalCachedDistanceProperty(t.z,r)||m.StyleParser.defaults.z,i.size=t.size,i.size=i.size?m.StyleParser.evalCachedProperty(i.size,r):o?o.size:[16,16],i.size=[Math.min(i.size[0]||i.size,256),Math.min(i.size[1]||i.size,256)],i.angle=m.StyleParser.evalProperty(t.angle,r)*Math.PI/180||0,i.sampler=0,this.computeLayout(i,e,t,r,n);var s=t.text&&t.text.visible!==!1&&this.parseTextFeature(e,t.text,r,n);s&&(s.layout.parent=i,s.layout.priority=t.text.priority?Math.max(s.layout.priority,i.priority+.5):i.priority+.5,s.layout.move_into_tile=!1,R.default.addStyle(this.collision_group_text,n.key)),this.tile_data[n.key]||this.startData(n),this.queues[n.key].push({feature:e,draw:t,context:r,style:i,text_feature:s}),R.default.addStyle(this.collision_group_points,n.key)}},startData:function(e){return this.queues[e.key]=[],p.Style.startData.call(this,e)},endData:function(e){var t=this;if(e.canceled)return void d.default("trace","Style "+this.name+": stop tile build because tile was canceled: "+e.key);var r=this.queues[e.key];this.queues[e.key]=[];var n=[],i=[];return r.forEach(function(e){for(var r=e.style,a=e.feature,o=a.geometry,s=t.buildLabels(r.size,o,r),l=0;l<s.length;l++){var u=s[l],c={feature:a,draw:e.draw,context:e.context,style:r,label:u};if(i.push(c),e.text_feature){var f={feature:a,draw:e.text_feature.draw,context:e.context,text:e.text_feature.text,text_settings_key:e.text_feature.text_settings_key,layout:e.text_feature.layout,point_label:u,linked:c};n.push(f),e.draw.text.optional||(c.linked=f)}}}),s.default.all([R.default.collide(i,this.collision_group_points,e.key).then(function(e){e.forEach(function(e){t.feature_style=e.style,t.feature_style.label=e.label,p.Style.addFeature.call(t,e.feature,e.draw,e.context)})}),this.prepareTextLabels(e,this.collision_group_text,n).then(function(r){return t.collideAndRenderTextLabels(e,t.collision_group_text,r)})]).then(function(r){var n=a.default(r,2),i=n[1],o=i.labels,s=i.texts,l=i.texture;return o&&s&&o.forEach(function(e){var r=e.text_settings_key,n=s[r]&&s[r][e.text],i=t.feature_style;i.label=e.label,i.size=n.size.logical_size,i.texcoords=n.align[e.label.align].texcoords,i.angle=e.label.angle||0,i.sampler=1,p.Style.addFeature.call(t,e.feature,e.draw,e.context)}),t.freeText(e),p.Style.endData.call(t,e).then(function(e){return l&&e&&(e.uniforms=e.uniforms||{},e.textures=e.textures||[],e.uniforms.u_label_texture=l,e.textures.push(l)),e})})},_preprocess:function(e){return e.color=m.StyleParser.createColorPropertyCache(e.color),e.z=m.StyleParser.createPropertyCache(e.z,m.StyleParser.parseUnits),e.size=m.StyleParser.createPropertyCache(e.size,function(e){return Array.isArray(e)?e.map(parseFloat):parseFloat(e)}),e.offset=m.StyleParser.createPropertyCache(e.offset,function(e){return Array.isArray(e)&&e.map(parseFloat)||0}),e.buffer=m.StyleParser.createPropertyCache(e.buffer,function(e){return(Array.isArray(e)?e:[e,e]).map(parseFloat)||0}),e.text=this.preprocessText(e.text),e.text&&(e.text.key=e.key,e.text.anchor=e.text.anchor||this.default_anchor,e.text.optional="boolean"==typeof e.text.optional?e.text.optional:!1),e},default_anchor:["bottom","top","right","left"],computeLayout:function(e,t,r,n,i){var a=e||{};a.id=t,a.units_per_pixel=i.units_per_pixel||1,a.collide=r.collide===!1?!1:!0,a.cull_from_tile=null!=r.cull_from_tile?r.cull_from_tile:!1,a.move_into_tile=null!=r.move_into_tile?r.move_into_tile:!1,a.centroid=r.centroid,a.anchor=r.anchor,a.offset=m.StyleParser.evalCachedProperty(r.offset,n)||m.StyleParser.zeroPair,a.buffer=m.StyleParser.evalCachedProperty(r.buffer,n)||m.StyleParser.zeroPair;var o=r.priority;return null!=o?"function"==typeof o&&(o=o(n)):o=-1>>>0,a.priority=o,a},buildTextLabels:function(e,t){for(var r=[],n=0;n<t.length;n++){var i=t[n],a=this.texts[e][i.text_settings_key][i.text],o=a.size.collision_size;i.label=new M.default(i.point_label.position,o,i.layout),r.push(i)}return r},buildLabels:function(e,t,r){var n=[];if("Point"===t.type)n.push(new M.default(t.coordinates,e,r));else if("MultiPoint"===t.type)for(var i=t.coordinates,a=0;a<i.length;++a){var o=i[a];n.push(new M.default(o,e,r))}else if("LineString"===t.type)for(var s=t.coordinates,l=0;l<s.length;++l)n.push(new M.default(s[l],e,r));else if("MultiLineString"===t.type)for(var u=t.coordinates,c=0;c<u.length;c++)for(var f=u[c],h=0;h<f.length;++h)n.push(new M.default(f[h],e,r));else if("Polygon"===t.type)if(r.centroid){var d=A.default.centroid(t.coordinates);n.push(new M.default(d,e,r))}else for(var p=t.coordinates,m=0;m<p.length;m++)for(var _=p[m],g=0;g<_.length;++g)n.push(new M.default(_[g],e,r));else if("MultiPolygon"===t.type){var v=A.default.multiCentroid(t.coordinates);n.push(new M.default(v,e,r))}return n},makeVertexTemplate:function(e){var t=e.color||m.StyleParser.defaults.color;return this.fillVertexTemplate("a_position",0,{size:2}),this.fillVertexTemplate("a_position",e.z||0,{size:1,offset:2}),this.fillVertexTemplate("a_position",this.scaleOrder(e.order),{size:1,offset:3}),this.fillVertexTemplate("a_shape",0,{size:4}),this.fillVertexTemplate("a_texcoord",0,{size:2}),this.fillVertexTemplate("a_offset",0,{size:2}),this.fillVertexTemplate("a_color",E.default.mult(t,255),{size:4}),this.selection&&this.fillVertexTemplate("a_selection_color",E.default.mult(e.selection_color,255),{size:4}),this.vertex_template},buildQuad:function(e,t,r,n,i,a,o,s){b.buildQuadsForPoints(e,o,s,{texcoord_index:this.vertex_layout.index.a_texcoord,position_index:this.vertex_layout.index.a_position,shape_index:this.vertex_layout.index.a_shape,offset_index:this.vertex_layout.index.a_offset},{quad:t,quad_normalize:256,offset:i,angle:4096*r,shape_w:n,texcoord_scale:a,texcoord_normalize:65535})},build:function(e,t){var r=e.label;r.num_segments?this.buildArticulatedLabel(r,e,t):this.buildLabel(r,e,t)},buildLabel:function(e,t,r){var n=this.makeVertexTemplate(t);this.buildQuad([e.position],t.size,t.angle,t.sampler,e.offset,t.texcoords,r,n)},buildArticulatedLabel:function(e,t,r){for(var n=this.makeVertexTemplate(t),i=0;i<e.num_segments;i++){var a=e.angle[i],o=t.size[i],s=e.offsets[i],l=t.texcoords[i];this.buildQuad([e.position],o,a,t.sampler,s,l,r,n)}},buildLines:function(e,t,r){this.build(t,r)},buildPoints:function(e,t,r){this.build(t,r)},buildPolygons:function(e,t,r){this.build(t,r)},makeMesh:function(e,t){var r=arguments.length<=2||void 0===arguments[2]?{}:arguments[2];return r=u.default({},r,{fade_in_time:this.fade_in_time}),p.Style.makeMesh.call(this,e,t,r)}})},{"../../builders/points":295,"../../geo":299,"../../gl/constants":300,"../../gl/texture":306,"../../gl/vertex_layout":311,"../../labels/collision":312,"../../labels/label_point":315,"../../utils/debug_settings":349,"../../utils/log":352,"../../vector":361,"../style":338,"../style_parser":340,"../text/text_labels":344,"babel-runtime/core-js/object/assign":9,"babel-runtime/core-js/object/create":10,"babel-runtime/core-js/promise":17,"babel-runtime/helpers/slicedToArray":27}],336:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(r,"__esModule",{value:!0}),r.shaderSrc_polygonsFragment=r.shaderSrc_polygonsVertex=r.Polygons=void 0;var i=e("babel-runtime/core-js/object/assign"),a=n(i),o=e("babel-runtime/core-js/object/create"),s=n(o),l=e("../style"),u=e("../style_parser"),c=e("../../gl/constants"),f=n(c),h=e("../../gl/vertex_layout"),d=n(h),p=e("../../builders/polygons"),m=e("../../geo"),_=n(m),g='uniform vec2 u_resolution;\nuniform float u_time;\nuniform vec3 u_map_position;\nuniform vec4 u_tile_origin;\nuniform float u_tile_proxy_depth;\nuniform float u_meters_per_pixel;\nuniform float u_device_pixel_ratio;\nuniform float u_visible_time;\nuniform bool u_fade_in;\n\nuniform mat4 u_model;\nuniform mat4 u_modelView;\nuniform mat3 u_normalMatrix;\nuniform mat3 u_inverseNormalMatrix;\n\nattribute vec4 a_position;\nattribute vec4 a_color;\n\n// Optional normal attribute, otherwise default to up\n#ifdef TANGRAM_NORMAL_ATTRIBUTE\n attribute vec3 a_normal;\n #define TANGRAM_NORMAL a_normal\n#else\n #define TANGRAM_NORMAL vec3(0., 0., 1.)\n#endif\n\n// Optional dynamic line extrusion\n#ifdef TANGRAM_EXTRUDE_LINES\n // xy: extrusion direction in xy plane\n // z: half-width of line (amount to extrude)\n // w: scaling factor for interpolating width between zooms\n attribute vec4 a_extrude;\n#endif\n\nvarying vec4 v_position;\nvarying vec3 v_normal;\nvarying vec4 v_color;\nvarying vec4 v_world_position;\n\n// Optional texture UVs\n#ifdef TANGRAM_TEXTURE_COORDS\n attribute vec2 a_texcoord;\n varying vec2 v_texcoord;\n#endif\n\n// Optional model position varying for tile coordinate zoom\n#ifdef TANGRAM_MODEL_POSITION_BASE_ZOOM_VARYING\n varying vec4 v_modelpos_base_zoom;\n#endif\n\n#if defined(TANGRAM_LIGHTING_VERTEX)\n varying vec4 v_lighting;\n#endif\n\n#pragma tangram: camera\n#pragma tangram: material\n#pragma tangram: lighting\n#pragma tangram: raster\n#pragma tangram: global\n\nvoid main() {\n // Initialize globals\n #pragma tangram: setup\n\n // Texture UVs\n #ifdef TANGRAM_TEXTURE_COORDS\n v_texcoord = a_texcoord;\n #ifdef TANGRAM_EXTRUDE_LINES\n v_texcoord.y *= TANGRAM_V_SCALE_ADJUST;\n #endif\n #endif\n\n // Pass model position to fragment shader\n #ifdef TANGRAM_MODEL_POSITION_BASE_ZOOM_VARYING\n v_modelpos_base_zoom = modelPositionBaseZoom();\n #endif\n\n // Position\n vec4 position = vec4(a_position.xy, a_position.z / TANGRAM_HEIGHT_SCALE, 1.); // convert height back to meters\n\n #ifdef TANGRAM_EXTRUDE_LINES\n vec2 extrude = a_extrude.xy / 256.; // values have an 8-bit fraction\n float width = a_extrude.z;\n float dwdz = a_extrude.w;\n\n // Adjust line width based on zoom level, to prevent proxied lines from being either too small or too big.\n // "Flattens" the zoom between 1-2 to peg it to 1 (keeps lines from prematurely shrinking), then interpolate\n // and clamp to 4 (keeps lines from becoming too small when far away).\n float dz = clamp(u_map_position.z - u_tile_origin.z, 0., 4.);\n dz += step(1., dz) * (1. - dz) + mix(0., 2., clamp((dz - 2.) / 2., 0., 1.));\n\n // Interpolate between zoom levels\n width += dwdz * dz;\n\n // Scale pixel dimensions to be consistent in screen space\n // Scale from style zoom units back to tile zoom\n width *= exp2(-dz - (u_tile_origin.z - u_tile_origin.w));\n\n // Modify line width before extrusion\n #pragma tangram: width\n\n position.xy += extrude * width;\n #endif\n\n // World coordinates for 3d procedural textures\n v_world_position = wrapWorldPosition(u_model * position);\n\n // Adjust for tile and view position\n position = u_modelView * position;\n\n // Modify position before camera projection\n #pragma tangram: position\n\n // Setup varyings\n v_position = position;\n v_normal = normalize(u_normalMatrix * TANGRAM_NORMAL);\n v_color = a_color;\n\n #if defined(TANGRAM_LIGHTING_VERTEX)\n // Vertex lighting\n vec3 normal = v_normal;\n\n // Modify normal before lighting\n #pragma tangram: normal\n\n // Pass lighting intensity to fragment shader\n v_lighting = calculateLighting(position.xyz - u_eye, normal, vec4(1.));\n #endif\n\n // Camera\n cameraProjection(position);\n\n // +1 is to keep all layers including proxies > 0\n applyLayerOrder(a_position.w + u_tile_proxy_depth + 1., position);\n\n gl_Position = position;\n}\n',v="uniform vec2 u_resolution;\nuniform float u_time;\nuniform vec3 u_map_position;\nuniform vec4 u_tile_origin;\nuniform float u_meters_per_pixel;\nuniform float u_device_pixel_ratio;\nuniform float u_visible_time;\nuniform bool u_fade_in;\n\nuniform mat3 u_normalMatrix;\nuniform mat3 u_inverseNormalMatrix;\n\nvarying vec4 v_position;\nvarying vec3 v_normal;\nvarying vec4 v_color;\nvarying vec4 v_world_position;\n\n#define TANGRAM_NORMAL v_normal\n\n#ifdef TANGRAM_TEXTURE_COORDS\n varying vec2 v_texcoord;\n#endif\n\n#ifdef TANGRAM_MODEL_POSITION_BASE_ZOOM_VARYING\n varying vec4 v_modelpos_base_zoom;\n#endif\n\n#if defined(TANGRAM_LIGHTING_VERTEX)\n varying vec4 v_lighting;\n#endif\n\n#pragma tangram: camera\n#pragma tangram: material\n#pragma tangram: lighting\n#pragma tangram: raster\n#pragma tangram: global\n\nvoid main (void) {\n // Initialize globals\n #pragma tangram: setup\n\n vec4 color = v_color;\n vec3 normal = TANGRAM_NORMAL;\n\n // Apply raster to vertex color\n #ifdef TANGRAM_RASTER_TEXTURE_COLOR\n color *= sampleRaster(0); // multiplied to tint texture color\n #endif\n\n // Apply line texture\n #ifdef TANGRAM_LINE_TEXTURE\n vec2 _line_st = vec2(v_texcoord.x, fract(v_texcoord.y / u_texture_ratio));\n vec4 _line_color = texture2D(u_texture, _line_st);\n\n if (_line_color.a < TANGRAM_ALPHA_TEST) {\n #ifdef TANGRAM_LINE_BACKGROUND_COLOR\n color.rgb = TANGRAM_LINE_BACKGROUND_COLOR;\n #elif !defined(TANGRAM_BLEND_OVERLAY) && !defined(TANGRAM_BLEND_INLAY)\n discard; // use discard when alpha blending is unavailable\n #else\n color.a = 0.; // use alpha channel when blending is available\n #endif\n }\n else {\n color *= _line_color;\n }\n #endif\n\n // First, get normal from raster tile (if applicable)\n #ifdef TANGRAM_RASTER_TEXTURE_NORMAL\n normal = normalize(sampleRaster(0).rgb * 2. - 1.);\n #endif\n\n // Second, alter normal with normal map texture (if applicable)\n #if defined(TANGRAM_LIGHTING_FRAGMENT) && defined(TANGRAM_MATERIAL_NORMAL_TEXTURE)\n calculateNormal(normal);\n #endif\n\n // Normal modification applied here for fragment lighting or no lighting,\n // and in vertex shader for vertex lighting\n #if !defined(TANGRAM_LIGHTING_VERTEX)\n #pragma tangram: normal\n #endif\n\n // Color modification before lighting is applied\n #pragma tangram: color\n\n #if defined(TANGRAM_LIGHTING_FRAGMENT)\n // Calculate per-fragment lighting\n color = calculateLighting(v_position.xyz - u_eye, normal, color);\n #elif defined(TANGRAM_LIGHTING_VERTEX)\n // Apply lighting intensity interpolated from vertex shader\n color *= v_lighting;\n #endif\n\n // Post-processing effects (modify color after lighting)\n #pragma tangram: filter\n\n gl_FragColor = color;\n}\n",y=r.Polygons=s.default(l.Style);r.shaderSrc_polygonsVertex=g,r.shaderSrc_polygonsFragment=v,a.default(y,{name:"polygons",built_in:!0,vertex_shader_src:g,fragment_shader_src:v,selection:!0,init:function(){l.Style.init.apply(this,arguments);var e=[{name:"a_position",size:4,type:f.default.SHORT,normalized:!1},{name:"a_normal",size:3,type:f.default.BYTE,normalized:!0},{name:"a_color",size:4,type:f.default.UNSIGNED_BYTE,normalized:!0}];this.defines.TANGRAM_NORMAL_ATTRIBUTE=!0,this.defines.TANGRAM_LAYER_ORDER=!0,this.selection&&e.push({name:"a_selection_color",size:4,type:f.default.UNSIGNED_BYTE,normalized:!0}),this.texcoords&&(this.defines.TANGRAM_TEXTURE_COORDS=!0,e.push({name:"a_texcoord",size:2,type:f.default.UNSIGNED_SHORT,normalized:!0})),this.vertex_layout=new d.default(e)},_parseFeature:function(e,t,r){var n=this.feature_style;return n.color=this.parseColor(t.color,r),n.color?(n.z=t.z&&u.StyleParser.evalCachedDistanceProperty(t.z,r)||u.StyleParser.defaults.z,n.z*=_.default.height_scale,n.extrude=u.StyleParser.evalProperty(t.extrude,r),n.extrude&&(n.extrude===!0?(n.height=e.properties.height||u.StyleParser.defaults.height,n.min_height=e.properties.min_height||u.StyleParser.defaults.min_height):"number"==typeof n.extrude?(n.height=n.extrude,n.min_height=0):Array.isArray(n.extrude)&&(n.min_height=n.extrude[0],n.height=n.extrude[1]),n.height*=_.default.height_scale,n.min_height*=_.default.height_scale),n.tile_edges=t.tile_edges,n):null},_preprocess:function(e){return e.color=u.StyleParser.createColorPropertyCache(e.color),e.z=u.StyleParser.createPropertyCache(e.z,u.StyleParser.parseUnits),e},makeVertexTemplate:function(e){var t=0;return this.vertex_template[t++]=0,this.vertex_template[t++]=0,this.vertex_template[t++]=e.z||0,this.vertex_template[t++]=this.scaleOrder(e.order),this.vertex_template[t++]=0,this.vertex_template[t++]=0,this.vertex_template[t++]=127,this.vertex_template[t++]=255*e.color[0],this.vertex_template[t++]=255*e.color[1],this.vertex_template[t++]=255*e.color[2],this.vertex_template[t++]=255*e.color[3],this.selection&&(this.vertex_template[t++]=255*e.selection_color[0],this.vertex_template[t++]=255*e.selection_color[1],this.vertex_template[t++]=255*e.selection_color[2],this.vertex_template[t++]=255*e.selection_color[3]),this.texcoords&&(this.vertex_template[t++]=0,this.vertex_template[t++]=0),this.vertex_template},buildPolygons:function(e,t,r,n){var i=this.makeVertexTemplate(t),a={texcoord_index:this.vertex_layout.index.a_texcoord,texcoord_normalize:65535,remove_tile_edges:!t.tile_edges,tile_edge_tolerance:_.default.tile_scale*n.tile.pad_scale*4,winding:n.winding};t.extrude&&t.height?p.buildExtrudedPolygons(e,t.z,t.height,t.min_height,r,i,this.vertex_layout.index.a_normal,127,a):p.buildPolygons(e,r,i,a)}})},{"../../builders/polygons":296,"../../geo":299,"../../gl/constants":300,"../../gl/vertex_layout":311,"../style":338,"../style_parser":340,"babel-runtime/core-js/object/assign":9,"babel-runtime/core-js/object/create":10}],337:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(r,"__esModule",{value:!0}),r.RasterStyle=void 0;var i=e("babel-runtime/core-js/object/assign"),a=n(i),o=e("babel-runtime/core-js/object/create"),s=n(o),l=e("../style_parser"),u=e("../polygons/polygons"),c=r.RasterStyle=s.default(u.Polygons);a.default(c,{name:"raster","super":u.Polygons,built_in:!0,selection:!1,init:function(){this.raster=this.raster||"color",this.super.init.apply(this,arguments)},_preprocess:function(e){return e.color=e.color||l.StyleParser.defaults.color,this.super._preprocess.apply(this,arguments)}})},{"../polygons/polygons":336,"../style_parser":340,"babel-runtime/core-js/object/assign":9,"babel-runtime/core-js/object/create":10}],338:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(r,"__esModule",{value:!0}),r.Style=void 0;var i=e("babel-runtime/helpers/slicedToArray"),a=n(i),o=e("babel-runtime/core-js/get-iterator"),s=n(o),l=e("babel-runtime/core-js/object/keys"),u=n(l),c=e("babel-runtime/core-js/object/assign"),f=n(c),h=e("babel-runtime/core-js/promise"),d=n(h),p=e("./style_parser"),m=e("../selection"),_=n(m),g=e("../gl/shader_program"),v=n(g),y=e("../gl/vbo_mesh"),b=n(y),x=e("../gl/texture"),w=n(x),k=e("../material"),A=n(k),T=e("../light"),E=n(T),S=e("../sources/raster"),R=e("../utils/log"),j=n(R),M=e("../utils/thread"),z=n(M),C=e("../utils/worker_broker"),P=n(C),N="// Fragment shader for feature selection passes\n// Renders in silhouette according to selection (picking) color, or black if none defined\n\n#ifdef TANGRAM_FEATURE_SELECTION\n varying vec4 v_selection_color;\n#endif\n\nvoid main (void) {\n #ifdef TANGRAM_FEATURE_SELECTION\n gl_FragColor = v_selection_color;\n #else\n gl_FragColor = vec4(0., 0., 0., 1.);\n #endif\n}\n",L="// Uniforms defining raster textures and macros for accessing them\n\n#ifdef TANGRAM_FRAGMENT_SHADER\nuniform sampler2D u_rasters[TANGRAM_NUM_RASTER_SOURCES]; // raster tile texture samplers\nuniform vec2 u_raster_sizes[TANGRAM_NUM_RASTER_SOURCES]; // raster tile texture sizes (width/height in pixels)\nuniform vec3 u_raster_offsets[TANGRAM_NUM_RASTER_SOURCES]; // raster tile texture UV starting offset for tile\n\n// Note: the raster accessors below are #defines rather than functions to\n// avoid issues with constant integer expressions for array indices\n\n// Adjusts UVs in model space to account for raster tile texture overzooming\n// (applies scale and offset adjustments)\n#define adjustRasterUV(raster_index, uv) \\\n ((uv) * u_raster_offsets[raster_index].z + u_raster_offsets[raster_index].xy)\n\n// Returns the UVs of the current model position for a raster sampler\n#define currentRasterUV(raster_index) \\\n (adjustRasterUV(raster_index, v_modelpos_base_zoom.xy))\n\n// Returns pixel location in raster tile texture at current model position\n#define currentRasterPixel(raster_index) \\\n (currentRasterUV(raster_index) * rasterPixelSize(raster_index))\n\n// Samples a raster tile texture for the current model position\n#define sampleRaster(raster_index) \\\n (texture2D(u_rasters[raster_index], currentRasterUV(raster_index)))\n\n// Samples a raster tile texture for a given pixel\n#define sampleRasterAtPixel(raster_index, pixel) \\\n (texture2D(u_rasters[raster_index], adjustRasterUV(raster_index, (pixel) / rasterPixelSize(raster_index))))\n\n// Returns size of raster sampler in pixels\n#define rasterPixelSize(raster_index) \\\n (u_raster_sizes[raster_index])\n\n#endif\n",O=r.Style={init:function(){var e=arguments.length<=0||void 0===arguments[0]?{}:arguments[0],t=e.generation,r=e.styles,n=e.sources,i=void 0===n?{}:n,a=e.introspection; 17 this.isBuiltIn()||(this.built_in=!1),this.generation=t,this.styles=r,this.sources=i,this.defines=this.hasOwnProperty("defines")&&this.defines||{},this.shaders=this.hasOwnProperty("shaders")&&this.shaders||{},this.introspection=a||!1,this.selection=this.selection||this.introspection||!1,this.compiling=!1,this.compiled=!1,this.program=null,this.selection_program=null,this.feature_style={},this.vertex_template=[],this.tile_data={},this.main_thread_target=["Style",this.name,this.generation].join("/"),z.default.is_main&&P.default.addTarget(this.main_thread_target,this),this.defines.TANGRAM_WORLD_POSITION_WRAP=1e5,this.blend=this.blend||"opaque",this.defines["TANGRAM_BLEND_"+this.blend.toUpperCase()]=!0,null==this.blend_order&&(this.blend_order=-1),this.material instanceof A.default||(A.default.isValid(this.material)||(this.material=p.StyleParser.defaults.material),this.material=new A.default(this.material)),this.material.inject(this),E.default.setMode(this.lighting,this),this.setupRasters(),this.initialized=!0},destroy:function(){this.program&&(this.program.destroy(),this.program=null),this.selection_program&&(this.selection_program.destroy(),this.selection_program=null),this.gl=null,this.initialized=!1},reset:function(){},isBuiltIn:function(){return this.hasOwnProperty("built_in")&&this.built_in},fillVertexTemplate:function(e,t,r){var n=r.size,i=r.offset;i=void 0===i?0:i;var a=this.vertex_layout.index[e];if(void 0===a)return void j.default("warn","Style: in style '"+this.name+"', no index found in vertex layout for attribute '"+e+"'");for(var o=0;n>o;++o){var s=t.length>o?t[o]:t;this.vertex_template[a+o+i]=s}},startData:function(e){return this.tile_data[e.key]={vertex_data:null,uniforms:{},textures:[]},this.tile_data[e.key]},endData:function(e){var t=this.tile_data[e.key];return this.tile_data[e.key]=null,t&&t.vertex_data&&t.vertex_data.vertex_count>0?(t.vertex_data.end(),t.vertex_elements=t.vertex_data.element_buffer,t.vertex_data=t.vertex_data.vertex_buffer,this.buildRasterTextures(e,t).then(function(){return t})):d.default.resolve(null)},hasDataForTile:function(e){return null!=this.tile_data[e]},addFeature:function(e,t,r){var n=r.tile;if(n.generation===this.generation){this.tile_data[n.key]||this.startData(n);var i=this.parseFeature(e,t,r);i&&(this.tile_data[n.key].vertex_data||(this.tile_data[n.key].vertex_data=this.vertex_layout.createVertexData()),this.buildGeometry(e.geometry,i,this.tile_data[n.key].vertex_data,r))}},buildGeometry:function(e,t,r,n){"Polygon"===e.type?this.buildPolygons([e.coordinates],t,r,n):"MultiPolygon"===e.type?this.buildPolygons(e.coordinates,t,r,n):"LineString"===e.type?this.buildLines([e.coordinates],t,r,n):"MultiLineString"===e.type?this.buildLines(e.coordinates,t,r,n):"Point"===e.type?this.buildPoints([e.coordinates],t,r,n):"MultiPoint"===e.type&&this.buildPoints(e.coordinates,t,r,n)},parseFeature:function(e,t,r){try{var n=this.feature_style;if(t=this.preprocess(t),!t)return;n.order=this.parseOrder(t.order,r);var i=!1;return n.interactive=this.introspection||t.interactive,this.selection&&(i=p.StyleParser.evalProperty(n.interactive,r)),n.selection_color=i?_.default.makeColor(e,r.tile,r):_.default.defaultColor,n=this._parseFeature(e,t,r)}catch(a){j.default("error","Style.parseFeature: style parsing error",e,n,a)}},_parseFeature:function(){return this.feature_style},preprocess:function(e){if(!e.preprocessed){if(e=this._preprocess(e),!e)return;e.preprocessed=!0}return e},_preprocess:function(e){return e},parseOrder:function(e,t){return"number"!=typeof e?p.StyleParser.calculateOrder(e,t):e},scaleOrder:function(e){return 2*e},parseColor:function(e,t){return e?p.StyleParser.evalCachedColorProperty(e,t):this.shaders.blocks.color||this.shaders.blocks.filter?p.StyleParser.defaults.color:void 0},buildPolygons:function(){},buildLines:function(){},buildPoints:function(){},setGL:function(e){this.gl=e,this.max_texture_size=w.default.getMaxTextureSize(this.gl)},makeMesh:function(e,t){var r=arguments.length<=2||void 0===arguments[2]?{}:arguments[2];return new b.default(this.gl,e,t,this.vertex_layout,r)},render:function(e){return e.render()},compile:function(){if(!this.gl)throw new Error("style.compile(): skipping for "+this.name+" because no GL context");if(this.compiling)throw new Error("style.compile(): skipping for "+this.name+" because style is already compiling");this.compiling=!0,this.compiled=!1;var e=this.buildDefineList();if(this.selection){var t=f.default({},e);t.TANGRAM_FEATURE_SELECTION=!0}var r=this.shaders&&this.shaders.blocks,n=this.shaders&&this.shaders.block_scopes,i=f.default({},this.shaders&&this.shaders.uniforms),a=this.shaders&&this.shaders.extensions;"string"==typeof a&&(a=[a]);try{this.program=new v.default(this.gl,this.vertex_shader_src,this.fragment_shader_src,{name:this.name,defines:e,uniforms:i,blocks:r,block_scopes:n,extensions:a}),this.program.compile(),this.selection?(this.selection_program=new v.default(this.gl,this.vertex_shader_src,N,{name:this.name+" (selection)",defines:t,uniforms:i,blocks:r,block_scopes:n,extensions:a}),this.selection_program.compile()):this.selection_program=null}catch(o){throw this.compiling=!1,this.compiled=!1,new Error("style.compile(): style "+this.name+" error:",o)}this.compiling=!1,this.compiled=!0},addShaderBlock:function(e,t){var r=arguments.length<=2||void 0===arguments[2]?null:arguments[2];this.shaders.blocks=this.shaders.blocks||{},this.shaders.blocks[e]=this.shaders.blocks[e]||[],this.shaders.blocks[e].push(t),this.shaders.block_scopes=this.shaders.block_scopes||{},this.shaders.block_scopes[e]=this.shaders.block_scopes[e]||[],this.shaders.block_scopes[e].push(r)},removeShaderBlock:function(e){this.shaders.blocks&&(this.shaders.blocks[e]=null)},replaceShaderBlock:function(e,t){var r=arguments.length<=2||void 0===arguments[2]?null:arguments[2];this.removeShaderBlock(e),this.addShaderBlock(e,t,r)},buildDefineList:function(){var e={};if(null!=this.defines)for(var t in this.defines)e[t]=this.defines[t];if(null!=this.shaders&&null!=this.shaders.defines)for(t in this.shaders.defines)e[t]=this.shaders.defines[t];return e},hasRasters:function(){return["color","normal","custom"].indexOf(this.raster)>-1},setupRasters:function(){var e=this;if(this.hasRasters()){"color"===this.raster?this.defines.TANGRAM_RASTER_TEXTURE_COLOR=!0:"normal"===this.raster&&(this.defines.TANGRAM_RASTER_TEXTURE_NORMAL=!0);var t=u.default(this.sources).filter(function(t){return e.sources[t]instanceof S.RasterTileSource}).length;this.defines.TANGRAM_NUM_RASTER_SOURCES="int("+t+")",t>0&&(this.defines.TANGRAM_MODEL_POSITION_BASE_ZOOM_VARYING=!0,this.replaceShaderBlock("raster",L,"Raster"))}},buildRasterTextures:function(e,t){var r=this;if(!this.hasRasters())return d.default.resolve(t);var n={},i={};return e.rasters.map(function(e){return r.sources[e]}).filter(function(e){return e}).forEach(function(t,r){if(t instanceof S.RasterTileSource){var a=t.tileTexture(e);n[a.url]=a,i[a.url]=r}}),0===u.default(n).length?d.default.resolve(t):P.default.postMessage(this.main_thread_target+".loadTextures",n).then(function(r){if(!r||r.length<1)return t;t.uniforms=t.uniforms||{},t.textures=t.textures||[];var o=t.uniforms.u_rasters=[],l=t.uniforms.u_raster_sizes=[],u=t.uniforms.u_raster_offsets=[],c=!0,f=!1,h=void 0;try{for(var d,p=s.default(r);!(c=(d=p.next()).done);c=!0){var m=a.default(d.value,3),_=m[0],g=m[1],v=m[2],y=i[_],b=n[_].coords;if(o[y]=_,t.textures.push(_),l[y]=[g,v],e.coords.z>b.z){var x=e.coords.z-b.z,w=Math.pow(2,x);u[y]=[e.coords.x%w/w,(w-1-e.coords.y%w)/w,1/w]}else u[y]=[0,0,1]}}catch(k){f=!0,h=k}finally{try{!c&&p.return&&p.return()}finally{if(f)throw h}}return t})},loadTextures:function(e){return w.default.createFromObject(this.gl,e).then(function(){return d.default.all(u.default(e).map(function(e){return w.default.textures[e]&&w.default.textures[e].load()}).filter(function(e){return e}))}).then(function(e){return e.forEach(function(e){return e.retain()}),e.map(function(e){return[e.name,e.width,e.height]})})},setup:function(){this.setUniforms(),this.material.setupProgram(v.default.current)},setUniforms:function(){var e=v.default.current;e&&e.setUniforms(this.shaders&&this.shaders.uniforms,!0)},render_states:{opaque:{depth_test:!0,depth_write:!0},add:{depth_test:!0,depth_write:!1},multiply:{depth_test:!0,depth_write:!1},inlay:{depth_test:!0,depth_write:!1},overlay:{depth_test:!1,depth_write:!1}},default_blend_orders:{opaque:0,add:1,multiply:2,inlay:3,overlay:4},blendOrderSort:function(e,t){return"opaque"===e.blend||"opaque"===t.blend?"opaque"===e.blend&&"opaque"===t.blend?e.name<t.name?-1:1:"opaque"===e.blend?-1:1:e.blend_order<t.blend_order?-1:e.blend_order>t.blend_order?1:O.default_blend_orders[e.blend]<O.default_blend_orders[t.blend]?-1:O.default_blend_orders[e.blend]>O.default_blend_orders[t.blend]?1:e.name<t.name?-1:1},update:function(){}}},{"../gl/shader_program":305,"../gl/texture":306,"../gl/vbo_mesh":308,"../light":319,"../material":320,"../selection":326,"../sources/raster":330,"../utils/log":352,"../utils/thread":357,"../utils/worker_broker":360,"./style_parser":340,"babel-runtime/core-js/get-iterator":4,"babel-runtime/core-js/object/assign":9,"babel-runtime/core-js/object/keys":15,"babel-runtime/core-js/promise":17,"babel-runtime/helpers/slicedToArray":27}],339:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(r,"__esModule",{value:!0}),r.StyleManager=void 0;{var i=e("babel-runtime/helpers/slicedToArray"),a=n(i),o=e("babel-runtime/core-js/object/define-property"),s=n(o),l=e("babel-runtime/core-js/object/assign"),u=n(l),c=e("babel-runtime/core-js/get-iterator"),f=n(c),h=e("babel-runtime/helpers/toConsumableArray"),d=n(h),p=e("babel-runtime/core-js/object/keys"),m=n(p),_=e("babel-runtime/core-js/object/create"),g=n(_),v=e("babel-runtime/helpers/classCallCheck"),y=n(v),b=e("babel-runtime/helpers/createClass"),x=n(b),w=e("../utils/utils"),k=n(w),A=e("../gl/shader_program"),T=n(A),E=e("../utils/merge"),S=n(E),R=e("../geo"),j=n(R),M=e("../utils/log"),z=n(M),C=e("./polygons/polygons"),P=e("./lines/lines"),N=e("./points/points"),L=e("./text/text"),O=e("./raster/raster"),I="#ifdef TANGRAM_VERTEX_SHADER\n\n// Vertex position in model space: [0, 1] range over the local tile\n// Note positions can be outside that range due to unclipped geometry, geometry higher than a unit cube, etc.\nvec4 modelPosition() {\n return\n vec4(\n a_position.xyz / TANGRAM_TILE_SCALE // scale coords to ~0-1 range\n * exp2(u_tile_origin.z - u_tile_origin.w), // adjust for tile overzooming\n 1.)\n + vec4(0., 1., 0., 0.);\n // NB: additional offset to account for unusual Tangram JS y coords,\n // should be refactored to remove\n}\n\n// Position in model space as above, but according to tile coordinate (as opposed to style) zoom\n// e.g. unadjusted for tile overzooming\nvec4 modelPositionBaseZoom() {\n return\n vec4(\n a_position.xyz / TANGRAM_TILE_SCALE, // scale coords to ~0-1 range\n 1.)\n + vec4(0., 1., 0., 0.); // see note on offset above\n}\n\n#endif\n\n// Vertex position in world coordinates, useful for 3d procedural textures, etc.\nvec4 worldPosition() {\n return v_world_position;\n}\n\n// Optionally wrap world coordinates (allows more precision at higher zooms)\n// e.g. at wrap 1000, the world space will wrap every 1000 meters\n#ifdef TANGRAM_VERTEX_SHADER\n\nvec4 wrapWorldPosition(vec4 world_position) {\n #if defined(TANGRAM_WORLD_POSITION_WRAP)\n vec2 anchor = u_tile_origin.xy - mod(u_tile_origin.xy, TANGRAM_WORLD_POSITION_WRAP);\n world_position.xy -= anchor;\n #endif\n return world_position;\n}\n\n#endif\n\n// Normal in world space\n#if defined(TANGRAM_VERTEX_SHADER)\n\nvec3 worldNormal() {\n return TANGRAM_NORMAL;\n}\n\n#elif defined(TANGRAM_FRAGMENT_SHADER)\n\nvec3 worldNormal() {\n return u_inverseNormalMatrix * TANGRAM_NORMAL;\n}\n\n#endif\n",F="// Apply layer ordering to avoid z-fighting\nvoid applyLayerOrder (float layer, inout vec4 position) {\n position.z -= layer * TANGRAM_LAYER_DELTA * position.w;\n}\n",U="// Vertex attribute + varying for feature selection\n#if defined(TANGRAM_FEATURE_SELECTION) && defined(TANGRAM_VERTEX_SHADER)\n attribute vec4 a_selection_color;\n varying vec4 v_selection_color;\n#endif\n",D="// Selection pass-specific rendering\n#if defined(TANGRAM_FEATURE_SELECTION) && defined(TANGRAM_VERTEX_SHADER)\n if (a_selection_color.rgb == vec3(0.)) {\n // Discard by forcing invalid triangle if we're in the feature\n // selection pass but have no selection info\n // TODO: in some cases we may actually want non-selectable features to occlude selectable ones?\n gl_Position = vec4(0., 0., 0., 1.);\n return;\n }\n v_selection_color = a_selection_color;\n#endif\n";r.StyleManager=function(){function e(){y.default(this,e),this.styles={},this.base_styles={},this.register(g.default(C.Polygons)),this.register(g.default(P.Lines)),this.register(g.default(N.Points)),this.register(g.default(L.TextStyle)),this.register(g.default(O.RasterStyle))}return x.default(e,[{key:"init",value:function(){T.default.removeBlock("global"),T.default.removeBlock("setup"),T.default.addBlock("global",I),T.default.addBlock("global",F),T.default.addBlock("global",U),T.default.replaceBlock("setup",D),T.default.defines.TANGRAM_EPSILON=1e-5,T.default.defines.TANGRAM_LAYER_DELTA=1/16384,T.default.defines.TANGRAM_TILE_SCALE="vec3("+j.default.tile_scale+"., "+j.default.tile_scale+"., u_meters_per_pixel * "+j.default.tile_size+".)",T.default.defines.TANGRAM_HEIGHT_SCALE=j.default.height_scale}},{key:"destroy",value:function(e){var t=this;m.default(this.styles).forEach(function(r){var n=t.styles[r];n.gl===e&&(z.default("trace","StyleManager.destroy: destroying render style "+n.name),n.isBuiltIn()||t.remove(n.name),n.destroy())})}},{key:"register",value:function(e){this.styles[e.name]=e,this.base_styles[e.name]=e}},{key:"remove",value:function(e){delete this.styles[e]}},{key:"mix",value:function(e,t){if(e.mixed)return e;e.mixed={};var r=[];if(e.mix){if(Array.isArray(e.mix)){var n;(n=r).push.apply(n,d.default(e.mix))}else r.push(e.mix);r=r.map(function(e){return t[e]}).filter(function(t){return t&&t!==e});var i=!0,a=!1,o=void 0;try{for(var s,l=f.default(r);!(i=(s=l.next()).done);i=!0){var c=s.value;e.mixed[c.name]=!0}}catch(h){a=!0,o=h}finally{try{!i&&l.return&&l.return()}finally{if(a)throw o}}}return r.push(e),e.animated=r.some(function(e){return e&&e.animated}),e.texcoords=r.some(function(e){return e&&e.texcoords}),e.base=r.map(function(e){return e.base}).filter(function(e){return e}).pop(),e.lighting=r.map(function(e){return e.lighting}).filter(function(e){return null!=e}).pop(),e.texture=r.map(function(e){return e.texture}).filter(function(e){return e}).pop(),e.raster=r.map(function(e){return e.raster}).filter(function(e){return null!=e}).pop(),e.dash=r.map(function(e){return e.dash}).filter(function(e){return null!=e}).pop(),e.dash_background_color=r.map(function(e){return e.dash_background_color}).filter(function(e){return null!=e}).pop(),r.some(function(e){return e.hasOwnProperty("blend")&&e.blend})&&(e.blend=r.map(function(e){return e.hasOwnProperty("blend")&&e.blend}).filter(function(e){return e}).pop()),e.blend_order=r.map(function(e){return e.blend_order}).filter(function(e){return null!=e}).pop(),e.defines=u.default.apply(Object,[{}].concat(d.default(r.map(function(e){return e.defines}).filter(function(e){return e})))),e.material=u.default.apply(Object,[{}].concat(d.default(r.map(function(e){return e.material}).filter(function(e){return e})))),this.mixShaders(e,t,r),e}},{key:"mixShaders",value:function(e,t,r){var n={},i=r.map(function(e){return e.shaders}).filter(function(e){return e});if(n.defines=u.default.apply(Object,[{}].concat(d.default(i.map(function(e){return e.defines}).filter(function(e){return e})))),n.uniforms={},n._uniforms=e.shaders&&e.shaders.uniforms||{},n._uniform_scopes={},r.filter(function(e){return e.shaders&&e.shaders.uniforms}).forEach(function(e){var r=function(r){n._uniform_scopes[r]=e.name,s.default(n.uniforms,r,{enumerable:!0,configurable:!0,get:function(){return void 0!==n._uniforms[r]?n._uniforms[r]:t[n._uniform_scopes[r]].shaders.uniforms!==n.uniforms?t[n._uniform_scopes[r]].shaders.uniforms[r]:void 0},set:function(e){n._uniforms[r]=e}})};for(var i in e.shaders.uniforms)r(i)}),n.extensions=m.default(i.map(function(e){return e.extensions}).filter(function(e){return e}).reduce(function(e,t){return"string"==typeof t?e[t]=!0:t.forEach(function(t){return e[t]=!0}),e},{})||{}),e.shaders&&e.shaders.blocks){e.shaders.block_scopes=e.shaders.block_scopes||{};var o=!0,l=!1,c=void 0;try{for(var h,p=f.default(k.default.entries(e.shaders.blocks));!(o=(h=p.next()).done);o=!0){var _=a.default(h.value,2),g=_[0],v=_[1];if(e.shaders.block_scopes[g]=e.shaders.block_scopes[g]||[],Array.isArray(v)){var y;(y=e.shaders.block_scopes[g]).push.apply(y,d.default(v.map(function(){return e.name})))}else e.shaders.block_scopes[g].push(e.name)}}catch(b){l=!0,c=b}finally{try{!o&&p.return&&p.return()}finally{if(l)throw c}}}var x={},w=!0,A=!1,T=void 0;try{for(var E,S=f.default(i);!(w=(E=S.next()).done);w=!0){var R=E.value;if(R.blocks){n.blocks=n.blocks||{},n.block_scopes=n.block_scopes||{};var j={},M=!0,z=!1,C=void 0;try{for(var P,N=f.default(k.default.entries(R.blocks));!(M=(P=N.next()).done);M=!0){var L=a.default(P.value,2),O=L[0],v=L[1],I=R.block_scopes[O];n.blocks[O]=n.blocks[O]||[],n.block_scopes[O]=n.block_scopes[O]||[],v=Array.isArray(v)?v:[v],I=Array.isArray(I)?I:[I];for(var F=0;F<v.length;F++)x[I[F]]||(j[I[F]]=!0,n.blocks[O].push(v[F]),n.block_scopes[O].push(I[F]))}}catch(b){z=!0,C=b}finally{try{!M&&N.return&&N.return()}finally{if(z)throw C}}u.default(x,j)}}}catch(b){A=!0,T=b}finally{try{!w&&S.return&&S.return()}finally{if(A)throw T}}return u.default(e.mixed,x),e.shaders=n,e}},{key:"create",value:function(e,t){var r=arguments.length<=2||void 0===arguments[2]?{}:arguments[2],n=S.default({},t);return n.name=e,n=this.mix(n,r),n.base&&this.base_styles[n.base]&&(this.styles[e]=n=u.default(g.default(this.base_styles[n.base]),n)),n}},{key:"build",value:function(e){var t=this,r=m.default(e).sort(function(r,n){return t.inheritanceDepth(r,e)-t.inheritanceDepth(n,e)});for(var n in this.styles)this.base_styles[n]?this.styles[n].reset():delete this.styles[n];var i={},a=!0,o=!1,s=void 0;try{for(var l,u=f.default(r);!(a=(l=u.next()).done);a=!0){var c=l.value;i[c]=this.create(c,e[c],i)}}catch(h){o=!0,s=h}finally{try{!a&&u.return&&u.return()}finally{if(o)throw s}}return this.styles}},{key:"initStyles",value:function(){var e=arguments.length<=0||void 0===arguments[0]?{}:arguments[0];for(var t in this.styles)this.styles[t].init(e)}},{key:"inheritanceDepth",value:function(e,t){for(var r=this,n=0;;){var i=t[e];if(!i)break;if(!i.mix)break;if(n++,Array.isArray(i.mix)){n+=Math.max.apply(Math,d.default(i.mix.map(function(n){return e!==n?r.inheritanceDepth(n,t):void 0})));break}if(e===i.mix)break;e=i.mix}return n}},{key:"compile",value:function(e,t){e=e||m.default(this.styles);var r=!0,n=!1,i=void 0;try{for(var a,o=f.default(e);!(r=(a=o.next()).done);r=!0){var s=a.value,l=this.styles[s];try{l.compile(),z.default("trace","StyleManager.compile(): compiled style "+s)}catch(u){z.default("error","StyleManager.compile(): error compiling style "+s+":",u),t.trigger("warning",{type:"styles",message:"Error compiling style "+s,style:l,shader_errors:l.program&&l.program.shader_errors})}}}catch(c){n=!0,i=c}finally{try{!r&&o.return&&o.return()}finally{if(n)throw i}}z.default("debug","StyleManager.compile(): compiled all styles")}}],[{key:"stylesForTile",value:function(e,t){var r=[];for(var n in t)t[n].hasDataForTile(e)&&r.push(n);return r}}]),e}()}},{"../geo":299,"../gl/shader_program":305,"../utils/log":352,"../utils/merge":354,"../utils/utils":358,"./lines/lines":334,"./points/points":335,"./polygons/polygons":336,"./raster/raster":337,"./text/text":343,"babel-runtime/core-js/get-iterator":4,"babel-runtime/core-js/object/assign":9,"babel-runtime/core-js/object/create":10,"babel-runtime/core-js/object/define-property":11,"babel-runtime/core-js/object/keys":15,"babel-runtime/helpers/classCallCheck":21,"babel-runtime/helpers/createClass":22,"babel-runtime/helpers/slicedToArray":27,"babel-runtime/helpers/toConsumableArray":28}],340:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(r,"__esModule",{value:!0}),r.StyleParser=void 0;var i=e("babel-runtime/core-js/object/freeze"),a=n(i),o=e("../utils/utils"),s=n(o),l=e("../geo"),u=n(l),c=e("csscolorparser"),f=n(c),h=r.StyleParser={};h.wrapFunction=function(e){var t="\n var feature = context.feature.properties;\n var global = context.global;\n var $zoom = context.zoom;\n var $layer = context.layer;\n var $geometry = context.geometry;\n var $meters_per_pixel = context.meters_per_pixel;\n\n var val = (function(){ "+e+" }());\n\n if (typeof val === 'number' && isNaN(val)) {\n val = null; // convert NaNs to nulls\n }\n\n return val;\n ";return t},h.zeroPair=a.default([0,0]),h.defaults={color:[1,1,1,1],width:1,size:1,extrude:!1,height:20,min_height:0,order:0,z:0,material:{ambient:1,diffuse:1}},h.macros={"Style.color.pseudoRandomColor":function(){return[.7*(parseInt(feature.id,16)/100%1),.7*(parseInt(feature.id,16)/1e4%1),.7*(parseInt(feature.id,16)/1e6%1),1]},"Style.color.randomColor":function(){return[.7*Math.random(),.7*Math.random(),.7*Math.random(),1]}},h.getFeatureParseContext=function(e,t,r){return{feature:e,tile:t,global:r,zoom:t.style_zoom,geometry:u.default.geometryType(e.geometry.type),meters_per_pixel:t.meters_per_pixel,meters_per_pixel_sq:t.meters_per_pixel_sq,units_per_meter_overzoom:t.units_per_meter_overzoom}},h.createPropertyCache=function(e){var t=arguments.length<=1||void 0===arguments[1]?null:arguments[1];if(null!=e){if(e.value)return{value:e.value,zoom:e.zoom?{}:null};var r={value:e};return Array.isArray(r.value)&&Array.isArray(r.value[0])&&(r.zoom={}),"function"==typeof t&&(r.zoom?r.value=r.value.map(function(e){return[e[0],t(e[1])]}):"function"!=typeof r.value&&(r.value=t(r.value))),r}},h.createColorPropertyCache=function(e){return h.createPropertyCache(e,function(e){return"Style.color.pseudoRandomColor"===e?s.default.stringToFunction(h.wrapFunction(h.macros["Style.color.pseudoRandomColor"])):"Style.color.randomColor"===e?h.macros["Style.color.randomColor"]:e})},h.evalCachedProperty=function(e,t){if(null!=e){if(e.dynamic){var r=e.dynamic(t);return r}if(e.static)return e.static;if(e.zoom&&e.zoom[t.zoom])return e.zoom[t.zoom];if("function"==typeof e.value){e.dynamic=e.value;var n=e.dynamic(t);return n}return Array.isArray(e.value)&&Array.isArray(e.value[0])?(e.zoom=e.zoom||{},e.zoom={},e.zoom[t.zoom]=s.default.interpolate(t.zoom,e.value),e.zoom[t.zoom]):(e.static=e.value,e.static)}},h.convertUnits=function(e,t){if(null!=e.val)return"px"===e.units?e.val*u.default.metersPerPixel(t.zoom):e.val;if("string"==typeof e){var r=e.match(/([0-9.-]+)([a-z]+)/);r&&3===r.length&&(e=parseFloat(r[1]),r=r[2]),"px"===r&&(e*=u.default.metersPerPixel(t.zoom))}else if(Array.isArray(e))return e.map(Array.isArray(e[0])?function(e){return[e[0],h.convertUnits(e[1],t)]}:function(e){return h.convertUnits(e,t)});return e},h.parseUnits=function(e){var t={val:parseFloat(e)};return 0!==t.val&&"string"==typeof e&&"px"===e.trim().slice(-2)&&(t.units="px"),t},h.evalCachedDistanceProperty=function(e,t){if(e.dynamic){var r=e.dynamic(t);return r}if(e.zoom&&e.zoom[t.zoom])return e.zoom[t.zoom];if("function"==typeof e.value){e.dynamic=e.value;var n=e.dynamic(t);return n}return e.zoom?(e.zoom[t.zoom]=s.default.interpolate(t.zoom,e.value,function(e){return h.convertUnits(e,t)}),e.zoom[t.zoom]):h.convertUnits(e.value,t)},h.string_colors={},h.colorForString=function(e){if(h.string_colors[e])return h.string_colors[e];var t=f.default.parseCSSColor(e);return t&&4===t.length?(t[0]/=255,t[1]/=255,t[2]/=255):t=h.defaults.color,h.string_colors[e]=t,t},h.evalCachedColorProperty=function(e){var t=arguments.length<=1||void 0===arguments[1]?{}:arguments[1];if(e.dynamic){var r=e.dynamic(t);return"string"==typeof r&&(r=h.colorForString(r)),r&&null==r[3]&&(r[3]=1),r}if(e.static)return e.static;if(e.zoom&&e.zoom[t.zoom])return e.zoom[t.zoom];if("function"==typeof e.value){e.dynamic=e.value;var n=e.dynamic(t);return"string"==typeof n&&(n=h.colorForString(n)),n&&null==n[3]&&(n[3]=1),n}if("string"==typeof e.value)return e.static=h.colorForString(e.value),e.static;if(e.zoom){if(!e.zoom_preprocessed){for(var i=0;i<e.value.length;i++){var a=e.value[i];a&&"string"==typeof a[1]&&(a[1]=h.colorForString(a[1]))}e.zoom_preprocessed=!0}return e.zoom[t.zoom]=s.default.interpolate(t.zoom,e.value),e.zoom[t.zoom][3]=e.zoom[t.zoom][3]||1,e.zoom[t.zoom]}return e.static=e.value,e.static&&null==e.static[3]&&(e.static[3]=1),e.static},h.parseColor=function(e){var t=arguments.length<=1||void 0===arguments[1]?{}:arguments[1];if("function"==typeof e&&(e=e(t)),"string"==typeof e)e=h.colorForString(e);else if(Array.isArray(e)&&Array.isArray(e[0])){for(var r=0;r<e.length;r++){var n=e[r];"string"==typeof n[1]&&(n[1]=h.colorForString(n[1]))}t.zoom&&(e=s.default.interpolate(t.zoom,e))}return e?null==e[3]&&(e[3]=1):e=[0,0,0,1],e},h.calculateOrder=function(e,t){return"function"==typeof e?e=e(t):"string"==typeof e&&(e=t.feature.properties[e]?t.feature.properties[e]:parseFloat(e)),e},h.evalProperty=function(e,t){return"function"==typeof e?e(t):e}},{"../geo":299,"../utils/utils":358,"babel-runtime/core-js/object/freeze":12,csscolorparser:165}],341:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function i(e){var t="\x00-@[-`{-¿×÷ʹ-˿ -⯿‐-\u2029 -⯿",r="֑-߿יִ-﷽ﹰ-ﻼ",n=new RegExp("^["+t+"]*["+r+"]");return n.test(e)}function a(e){for(var t=[],r=[],n=0;n<e.length;n++){var a=e[n],o=i(a);if(o)r.push(a);else{for(;r.length>0;)t.push(r.pop());t.push(a)}}for(;r.length>0;)t.push(r.pop());return t}function o(e){var t=e.split(" ");return a(t)}Object.defineProperty(r,"__esModule",{value:!0});var s=e("babel-runtime/helpers/slicedToArray"),l=n(s),u=e("babel-runtime/helpers/classCallCheck"),c=n(u),f=e("babel-runtime/helpers/createClass"),h=n(f),d=e("../../utils/utils"),p=n(d),m=e("../../gl/texture"),_=n(m),g=e("./font_manager"),v=n(g),y=e("../../utils/debug_settings"),b=n(y),x=function(){function e(){c.default(this,e),this.canvas=document.createElement("canvas"),this.canvas.style.backgroundColor="transparent",this.context=this.canvas.getContext("2d"),this.vertical_text_buffer=8,this.horizontal_text_buffer=4}return h.default(e,[{key:"resize",value:function(e,t){this.canvas.width=e,this.canvas.height=t,this.context.clearRect(0,0,e,t)}},{key:"setFont",value:function(e){var t=e.font_css,r=e.fill,n=e.stroke,i=e.stroke_width,a=e.px_size;this.px_size=a;var o=this.context,s=p.default.device_pixel_ratio;n&&i>0&&(o.strokeStyle=n,o.lineWidth=i*s),o.fillStyle=r,o.font=t,o.miterLimit=2}},{key:"textSizes",value:function(t){var r=this,n=p.default.device_pixel_ratio;return v.default.loadFonts().then(function(){for(var i in t){e.text_cache[i]=e.text_cache[i]||{};var a=t[i],s=!0,l=void 0;for(var u in a){var c=a[u],f=c.text_settings;if(s&&(r.setFont(f),l=r.context.measureText(" ").width/n,s=!1),c.space_width=l,f.can_articulate){var h=o(u);c.segments=h,c.size=[];for(var d=0;d<h.length;d++){var p=h[d];e.text_cache[i][p]?e.cache_stats.hits++:(e.text_cache[i][p]=r.textSize(p,f),e.cache_stats.misses++),c.size.push(e.text_cache[i][p].size)}}else e.text_cache[i][u]?e.cache_stats.hits++:(e.text_cache[i][u]=r.textSize(u,f),e.cache_stats.misses++),c.size=e.text_cache[i][u].size}}return t})}},{key:"textSize",value:function(e,t){var r=t.transform,n=t.text_wrap,i=t.max_lines,a=t.stroke_width,o=void 0===a?0:a,s=p.default.device_pixel_ratio,l=this.applyTextTransform(e,r),u=this.context,c=this.vertical_text_buffer*s,f=s*(o+this.horizontal_text_buffer),h=2*s,d=this.px_size+h,m=w.parse(l,n,i,d,u),_=m.height,g=m.width,v=m.lines,y=[g/s,_/s],b=[g+2*f,_+2*c],x=[b[0]/s,b[1]/s];return{lines:v,size:{collision_size:y,texture_size:b,logical_size:x,line_height:d}}}},{key:"drawTextMultiLine",value:function(e,t,r,n){for(var i=l.default(t,2),a=i[0],o=i[1],s=n.stroke,u=n.stroke_width,c=void 0===u?0:u,f=n.transform,h=n.align,d=r.line_height,m=o,_=0;_<e.length;_++){var g=e[_];this.drawTextLine(g,[a,m],r,{stroke:s,stroke_width:c,transform:f,align:h}),m+=d}if(b.default.draw_label_collision_boxes){this.context.save();var v=p.default.device_pixel_ratio,y=v*(this.horizontal_text_buffer+c),x=v*this.vertical_text_buffer,w=r.collision_size,k=2;this.context.strokeStyle="blue",this.context.lineWidth=k,this.context.strokeRect(a+y,o+x,v*w[0],v*w[1]),this.context.restore()}if(b.default.draw_label_texture_boxes){this.context.save();var A=r.texture_size,T=2;this.context.strokeStyle="green",this.context.lineWidth=T,this.context.strokeRect(a+T,o+T,A[0]-2*T,A[1]-2*T),this.context.restore()}}},{key:"drawTextLine",value:function(e,t,r,n){var i=l.default(t,2),a=i[0],o=i[1],s=n.stroke,u=n.stroke_width,c=void 0===u?0:u,f=n.transform,h=n.align,d=p.default.device_pixel_ratio;h=h||"center";var m=this.vertical_text_buffer*d,_=r.texture_size,g=r.line_height,v=d*(c+this.horizontal_text_buffer),y=this.applyTextTransform(e.text,f),b=void 0;"left"===h?b=a+v:"center"===h?b=a+_[0]/2-e.width/2:"right"===h&&(b=a+_[0]-e.width-v);var x=o+.75*m+g;s&&c>0&&this.context.strokeText(y,b,x),this.context.fillText(y,b,x)}},{key:"rasterize",value:function(t,r,n){for(var i in t){var a=t[i],o=!0;for(var s in a){var l=a[s],u=l.text_settings;if(o&&(this.setFont(u),o=!1),u.can_articulate){var c=l.segments;l.texcoords=[];for(var f=0;f<c.length;f++){var h=c[f],d=void 0;if(e.texcoord_cache[n][i][h].texcoord)d=e.texcoord_cache[n][i][h].texcoord;else{var p=e.texcoord_cache[n][i][h].texture_position,m=e.text_cache[i][h].size,g=e.text_cache[i][h].lines;this.drawTextMultiLine(g,p,m,u),d=_.default.getTexcoordsForSprite(p,m.texture_size,r),e.texcoord_cache[n][i][h].texcoord=d}l.texcoords.push(d)}}else{var v=e.text_cache[i][s].lines;for(var y in l.align)this.drawTextMultiLine(v,l.align[y].texture_position,l.size,{stroke:u.stroke,stroke_width:u.stroke_width,transform:u.transform,align:y}),l.align[y].texcoords=_.default.getTexcoordsForSprite(l.align[y].texture_position,l.size.texture_size,r)}}}}},{key:"setTextureTextPositions",value:function(t,r,n){e.texcoord_cache[n]||(e.texcoord_cache[n]={});var i=0,a=0,o=0,s=0;for(var l in t){e.texcoord_cache[n][l]||(e.texcoord_cache[n][l]={});var u=t[l];for(var c in u){var f=u[c];if(f.text_settings.can_articulate)for(var h=void 0,d=0;d<f.size.length;d++){var p=f.segments[d];if(!e.texcoord_cache[n][l][p]){var m=f.size[d].texture_size;m[0]>i&&(i=m[0]),o+m[1]<r?(h=[a,o],o+=m[1],o>s&&(s=o)):(a+=i,i=0,o=0,h=[a,o]),e.texcoord_cache[n][l][p]={texture_position:h}}}else{var _=f.size.texture_size;_[0]>i&&(i=_[0]);for(var g in f.align)o+_[1]<r?(f.align[g].texture_position=[a,o],o+=_[1],o>s&&(s=o)):(a+=i,i=0,o=0,f.align[g].texture_position=[a,o])}}}return[a+i,s]}},{key:"applyTextTransform",value:function(e,t){return"capitalize"===t?e.replace(/\w\S*/g,function(e){return e.charAt(0).toUpperCase()+e.substr(1)}):"uppercase"===t?e.toUpperCase():"lowercase"===t?e.toLowerCase():e}},{key:"clearTexcoordCache",value:function(t){e.texcoord_cache[t]={}}}],[{key:"fontPixelSize",value:function(t){if(null!=t){t="string"==typeof t?t:String(t);var r=t.match(e.font_size_re)||[],n=l.default(r,3),i=n[1],a=n[2];return a=a||"px","em"===a?i*=16:"pt"===a?i/=.75:"%"===a&&(i/=6.25),i=parseFloat(i),i*=p.default.device_pixel_ratio}}}]),e}();r.default=x,x.font_size_re=/((?:[0-9]*\.)?[0-9]+)\s*(px|pt|em|%)?/,x.text_cache={},x.cache_stats={hits:0,misses:0},x.texcoord_cache={};var w=function(){function e(t){var r=arguments.length<=1||void 0===arguments[1]?1/0:arguments[1],n=arguments.length<=2||void 0===arguments[2]?1/0:arguments[2]; 18 c.default(this,e),this.width=0,this.height=0,this.lines=[],this.ellipsis="...",this.ellipsis_width=t.measureText(this.ellipsis).width,this.max_lines=r,this.text_wrap=n,this.context=t}return h.default(e,[{key:"createLine",value:function(e){return this.lines.length<this.max_lines?new k(e,this.text_wrap):!1}},{key:"push",value:function(e){if(this.lines.length<this.max_lines){var t=this.context.measureText(e.text).width;return e.width=t,t>this.width&&(this.width=Math.ceil(t)),this.lines.push(e),this.height+=e.height,!0}return this.addEllipsis(),!1}},{key:"advance",value:function(e,t){var r=this.push(e);return r?this.createLine(t):!1}},{key:"addEllipsis",value:function(){var e=this.lines[this.lines.length-1];e.append(this.ellipsis),e.width+=this.ellipsis_width,e.width>this.width&&(this.width=e.width)}},{key:"finish",value:function(e){e?this.push(e):this.addEllipsis()}}],[{key:"parse",value:function(t,r,n,i,a){var o=void 0;o="number"==typeof r?t.split(" "):[t];for(var s=new e(a,n,r),l=s.createLine(i),u=0;u<o.length;u++){for(var c=o[u].split("\n"),f=0===u?!0:!1,h=0;h<c.length&&l;h++){var d=c[h].trim();if(d){var p=f?d:" "+d;if(r&&u>0&&l.exceedsTextwrap(p)){if(l=s.advance(l,i),!l)break;l.append(d),f=!0}else l.append(p);h<c.length-1&&(l=s.advance(l,i),f=!0)}}u===o.length-1&&s.finish(l)}return s}}]),e}(),k=function(){function e(){var t=arguments.length<=0||void 0===arguments[0]?0:arguments[0],r=arguments.length<=1||void 0===arguments[1]?0:arguments[1];c.default(this,e),this.chars=0,this.text="",this.height=t,this.text_wrap=r}return h.default(e,[{key:"append",value:function(e){this.chars+=e.length,this.text+=e}},{key:"exceedsTextwrap",value:function(e){return e.length+this.chars>this.text_wrap}}]),e}()},{"../../gl/texture":306,"../../utils/debug_settings":349,"../../utils/utils":358,"./font_manager":342,"babel-runtime/helpers/classCallCheck":21,"babel-runtime/helpers/createClass":22,"babel-runtime/helpers/slicedToArray":27}],342:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(r,"__esModule",{value:!0});var i=e("babel-runtime/core-js/object/assign"),a=n(i),o=e("babel-runtime/helpers/typeof"),s=n(o),l=e("babel-runtime/core-js/promise"),u=n(l),c=e("../../utils/log"),f=n(c),h=e("../../utils/utils"),d=n(h),p=e("fontfaceobserver"),m=n(p),_={fonts_loaded:u.default.resolve(),loadFonts:function(e){var t=this;return e&&!function(){var r=[],n=function(n){Array.isArray(e[n])?e[n].forEach(function(e){return r.push(t.loadFontFace(n,e))}):r.push(t.loadFontFace(n,e[n]))};for(var i in e)n(i);t.fonts_loaded=u.default.all(r.filter(function(e){return e}))}(),this.fonts_loaded},loadFontFace:function(e,t){if(null!=t&&("object"===("undefined"==typeof t?"undefined":s.default(t))||"external"===t)){var r={family:e},n=u.default.resolve();"object"===("undefined"==typeof t?"undefined":s.default(t))&&(a.default(r,t),"string"==typeof t.url&&(n=this.injectFontFace(r)));var i=new m.default(e,r);return n.then(function(){return i.load()}).then(function(){f.default("debug","Font face '"+e+"' is available",r)},function(){f.default("debug","Font face '"+e+"' is NOT available",r)})}},injectFontFace:function(e){var t=this,r=e.family,n=e.url,i=e.weight,a=e.style;void 0===this.supports_native_font_loading&&(this.supports_native_font_loading=void 0!==window.FontFace);var o=u.default.resolve(n);return"blob:"===n.slice(0,5)&&(o=d.default.io(n,6e4,"arraybuffer").then(function(e){var r=new Uint8Array(e);if(t.supports_native_font_loading)return r;for(var n="",i=0;i<r.length;i++)n+=String.fromCharCode(r[i]);return"data:font/opentype;base64,"+btoa(n)})),o.then(function(e){if(t.supports_native_font_loading){var n=void 0;"string"==typeof e?n=new FontFace(r,"url("+encodeURI(e)+")",{weight:i,style:a}):e instanceof Uint8Array&&(n=new FontFace(r,e,{weight:i,style:a})),document.fonts.add(n),f.default("trace","Adding FontFace to document.fonts:",n)}else{var o="\n @font-face {\n font-family: '"+r+"';\n font-weight: "+(i||"normal")+";\n font-style: "+(a||"normal")+";\n src: url("+encodeURI(e)+");\n }\n ",s=document.createElement("style");s.appendChild(document.createTextNode("")),document.head.appendChild(s),s.sheet.insertRule(o,0),f.default("trace","Injecting CSS font face:",o)}})}};r.default=_},{"../../utils/log":352,"../../utils/utils":358,"babel-runtime/core-js/object/assign":9,"babel-runtime/core-js/promise":17,"babel-runtime/helpers/typeof":29,fontfaceobserver:169}],343:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function i(e){for(var t=[],r=[],n=1/0,i=1/0;e&&!e.throw_away;)e.kink_index>0?e.fitness<i&&(i=e.fitness,r.unshift(e)):e.fitness<n&&(n=e.fitness,t.unshift(e)),e=v.default.nextLabel(e);var a=t[0],o=r[0];return t.length&&a.fitness<b?a:r.length&&o.fitness<x?o:a||o}Object.defineProperty(r,"__esModule",{value:!0}),r.TextStyle=void 0;var a=e("babel-runtime/core-js/object/assign"),o=n(a),s=e("babel-runtime/core-js/object/create"),l=n(s),u=e("../../geo"),c=n(u),f=e("../style"),h=e("../points/points"),d=e("../../labels/collision"),p=n(d),m=e("../../labels/label_point"),_=n(m),g=e("../../labels/label_line"),v=n(g),y=r.TextStyle=l.default(h.Points);o.default(y,{name:"text","super":h.Points,built_in:!0,selection:!1,init:function(){this.super.init.apply(this,arguments),this.defines.TANGRAM_POINT_TEXTURE=!0,this.defines.TANGRAM_MULTI_SAMPLER=!1,this.defines.TANGRAM_UNMULTIPLY_ALPHA=!0,this.defines.TANGRAM_FADE_ON_ZOOM_OUT=!0,this.defines.TANGRAM_FADE_ON_ZOOM_OUT_RATE=2,this.reset()},reset:function(){this.queues={},this.resetText()},addFeature:function(e,t,r){var n=r.tile;if(n.generation===this.generation&&(t=this.preprocess(t))){var i=e.geometry.type;t.can_articulate="LineString"===i||"MultiLineString"===i;var a=this.parseTextFeature(e,t,r,n);a&&(a.feature=e,a.context=r,a.layout.vertex=!1,this.tile_data[n.key]||this.startData(n),this.queues[n.key].push(a),p.default.addStyle(this.name,n.key))}},startData:function(e){return this.queues[e.key]=[],f.Style.startData.call(this,e)},endData:function(e){var t=this;return this.prepareTextLabels(e,this.name,this.queues[e.key]).then(function(r){return t.collideAndRenderTextLabels(e,t.name,r)}).then(function(r){var n=r.labels,i=r.texts,a=r.texture;return i&&(t.texts[e.key]=i,n.forEach(function(r){var n=r.text_settings_key,i=t.texts[e.key][n]&&t.texts[e.key][n][r.text],a=t.feature_style;a.label=r.label,i.text_settings.can_articulate?(a.size=i.size.map(function(e){return e.logical_size}),a.texcoords=i.texcoords):(a.size=i.size.logical_size,a.angle=r.label.angle||0,a.texcoords=i.align[r.label.align].texcoords),f.Style.addFeature.call(t,r.feature,r.draw,r.context)})),t.freeText(e),f.Style.endData.call(t,e).then(function(e){return a&&e?(e.uniforms.u_texture=a,e.textures.push(a),e):void 0})})},_preprocess:function(e){return this.preprocessText(e)},buildTextLabels:function(e,t){for(var r=[],n=0;n<t.length;n++){var i=t[n],a=this.texts[e][i.text_settings_key][i.text],o=void 0;if(a.text_settings.can_articulate){var s=a.size.map(function(e){return e.collision_size});i.layout.space_width=a.space_width,o=this.buildLabels(s,i.feature.geometry,i.layout)}else o=this.buildLabels(a.size.collision_size,i.feature.geometry,i.layout);for(var u=0;u<o.length;u++){var c=l.default(i);c.label=o[u],r.push(c)}}return r},buildLabels:function(e,t,r){var n=[];if("LineString"===t.type)this.buildLineLabels(t.coordinates,e,r,n);else if("MultiLineString"===t.type)for(var i=t.coordinates,a=0;a<i.length;++a)this.buildLineLabels(i[a],e,r,n);else if("Point"===t.type)n.push(new _.default(t.coordinates,e,r));else if("MultiPoint"===t.type)for(var o=t.coordinates,s=0;s<o.length;++s)n.push(new _.default(o[s],e,r));else if("Polygon"===t.type){var l=c.default.centroid(t.coordinates);n.push(new _.default(l,e,r))}else if("MultiPolygon"===t.type){var u=c.default.multiCentroid(t.coordinates);n.push(new _.default(u,e,r))}return n},buildLineLabels:function(e,t,r,n){var a=Math.min(r.subdiv,e.length-1);if(a>1){for(var o=(e.length-1)/a,s=0;a>s;s++)r.segment_start=Math.floor(s*o),r.segment_end=Math.floor((s+1)*o),n.push(new v.default(t,e,r));r.segment_start=null,r.segment_end=null}else{var l=new v.default(t,e,r);if(!l.throw_away){var u=i(l);u&&n.push(u)}}}});var b=.4,x=.5;y.texture_id=0},{"../../geo":299,"../../labels/collision":312,"../../labels/label_line":314,"../../labels/label_point":315,"../points/points":335,"../style":338,"babel-runtime/core-js/object/assign":9,"babel-runtime/core-js/object/create":10}],344:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(r,"__esModule",{value:!0}),r.TextLabels=void 0;{var i=e("babel-runtime/helpers/typeof"),a=n(i),o=e("babel-runtime/helpers/toConsumableArray"),s=n(o),l=e("babel-runtime/core-js/promise"),u=n(l),c=e("babel-runtime/core-js/object/keys"),f=n(c),h=e("../style_parser"),d=e("../../gl/texture"),p=n(d),m=e("../../geo"),_=n(m),g=e("../../utils/log"),v=n(g),y=e("../../utils/thread"),b=n(y),x=e("../../utils/worker_broker"),w=n(x),k=e("../../labels/collision"),A=n(k),T=e("../text/text_settings"),E=n(T),S=e("../text/canvas_text"),R=n(S),j=0;r.TextLabels={resetText:function(){b.default.is_main?this.canvas=new R.default:b.default.is_worker&&(this.texts={})},freeText:function(e){delete this.texts[e.key]},parseTextFeature:function(e,t,r,n){var i=this.parseTextSource(e,t,r);if(null!=i){var a=this.computeTextLayout({},e,t,r,n,i),o=E.default.compute(e,t,r),s=E.default.key(o);this.texts[n.key]=this.texts[n.key]||{};var l=this.texts[n.key][s]=this.texts[n.key][s]||{};return l[i]||(l[i]={text_settings:o,ref:0}),{draw:t,text:i,text_settings_key:s,layout:a}}},parseTextSource:function(e,t,r){var n=void 0,i=t.text_source||"name";if(Array.isArray(i))for(var a=0;a<i.length&&("string"==typeof i[a]?n=e.properties[i[a]]:"function"==typeof i[a]&&(n=i[a](r)),!n);a++);else"string"==typeof i?n=e.properties[i]:"function"==typeof i&&(n=i(r));return n},prepareTextLabels:function(e,t,r){var n=this;return 0===f.default(this.texts[e.key]||{}).length?u.default.resolve({}):w.default.postMessage(this.main_thread_target+".calcTextSizes",this.texts[e.key]).then(function(t){return e.canceled?void v.default("trace","Style "+n.name+": stop tile build because tile was canceled: "+e.key+", post-calcTextSizes()"):(n.texts[e.key]=t,t?n.buildTextLabels(e.key,r):void 0)})},collideAndRenderTextLabels:function(e,t,r){var n=this;return r?A.default.collide(r,t,e.key).then(function(t){if(e.canceled)return v.default("trace","stop tile build because tile was canceled: "+e.key+", post-collide()"),{};if(0===t.length)return{};var r=n.texts[e.key];return n.cullTextStyles(r,t),t.forEach(function(e){var t=e.text_settings_key,n=r[t]&&r[t][e.text];n.text_settings.can_articulate||(n.align=n.align||{},n.align[e.label.align]={})}),w.default.postMessage(n.main_thread_target+".rasterizeTexts",e.key,r).then(function(r){var n=r.texts,i=r.texture;return e.canceled?(v.default("trace","stop tile build because tile was canceled: "+e.key+", post-rasterizeTexts()"),{}):{labels:t,texts:n,texture:i}})}):(A.default.collide({},t,e.key),u.default.resolve({}))},cullTextStyles:function(e,t){for(var r=0;r<t.length;r++){var n=t[r];e[n.text_settings_key][n.text].ref++}for(var i in e)for(var a in e[i])e[i][a].ref<1&&delete e[i][a];for(var o in e)0===f.default(e[o]).length&&delete e[o]},calcTextSizes:function(e){return this.canvas.textSizes(e)},rasterizeTexts:function(e,t){var r=new R.default;r.clearTexcoordCache(e);var n=r.setTextureTextPositions(t,this.max_texture_size,e);v.default("trace","text summary for tile "+e+": fits in "+n[0]+"x"+n[1]+"px"),n[0]<this.max_texture_size&&n[1]<this.max_texture_size?(r.resize.apply(r,s.default(n)),r.rasterize(t,n,e)):v.default("error",["Label atlas for tile "+e+" is "+n[0]+"x"+n[1]+"px, ","but max GL texture size is "+this.max_texture_size+"x"+this.max_texture_size+"px"].join(""));var i="labels-"+e+"-"+j++;return p.default.create(this.gl,i,{element:r.canvas,filtering:"linear",UNPACK_PREMULTIPLY_ALPHA_WEBGL:!0}),p.default.retain(i),{texts:t,texture:i}},preprocessText:function(e){return e&&e.font&&"object"===a.default(e.font)?(e.font.fill=h.StyleParser.createPropertyCache(e.font.fill),e.font.stroke&&(e.font.stroke.color=h.StyleParser.createPropertyCache(e.font.stroke.color)),e.font.px_size=h.StyleParser.createPropertyCache(e.font.size||E.default.defaults.size,R.default.fontPixelSize),e.font.stroke&&null!=e.font.stroke.width&&(e.font.stroke.width=h.StyleParser.createPropertyCache(e.font.stroke.width,parseFloat)),e.offset=h.StyleParser.createPropertyCache(e.offset,function(e){return Array.isArray(e)&&e.map(parseFloat)||0}),e.buffer=h.StyleParser.createPropertyCache(e.buffer,function(e){return(Array.isArray(e)?e:[e,e]).map(parseFloat)||0}),e.repeat_distance=h.StyleParser.createPropertyCache(e.repeat_distance,parseFloat),e):void 0},computeTextLayout:function(e,t,r,n,i,a){var o=e||{};return o=this.computeLayout(o,t,r,n,i),o.cull_from_tile=null!=r.cull_from_tile?r.cull_from_tile:!0,o.move_into_tile=null!=r.move_into_tile?r.move_into_tile:!0,o.repeat_distance=h.StyleParser.evalCachedProperty(r.repeat_distance,n),null==o.repeat_distance&&(o.repeat_distance=_.default.tile_size),o.repeat_distance*=o.units_per_pixel,o.repeat_group="function"==typeof r.repeat_group?r.repeat_group(n):"string"==typeof r.repeat_group?r.repeat_group:r.key,o.repeat_group+="/"+a,o.subdiv=i.overzoom2,o.align=r.align,o}}}},{"../../geo":299,"../../gl/texture":306,"../../labels/collision":312,"../../utils/log":352,"../../utils/thread":357,"../../utils/worker_broker":360,"../style_parser":340,"../text/canvas_text":341,"../text/text_settings":345,"babel-runtime/core-js/object/keys":15,"babel-runtime/core-js/promise":17,"babel-runtime/helpers/toConsumableArray":28,"babel-runtime/helpers/typeof":29}],345:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(r,"__esModule",{value:!0});var i,a=e("../../utils/utils"),o=n(a),s=e("../../geo"),l=n(s),u=e("../style_parser");r.default=i={key:function(e){return[e.style,e.weight,e.family,e.px_size,e.fill,e.stroke,e.stroke_width,e.transform,e.text_wrap,e.max_lines,o.default.device_pixel_ratio].join("/")},defaults:{style:"normal",weight:null,size:"12px",px_size:12,family:"Helvetica",fill:"white",text_wrap:15,max_lines:5,align:"center",stroke:null,stroke_width:0},compute:function(e,t,r){var n={};t.font=t.font||this.defaults,n.can_articulate=t.can_articulate,n.fill=t.font.fill&&o.default.toCSSColor(u.StyleParser.evalCachedColorProperty(t.font.fill,r))||this.defaults.fill,n.style=t.font.style||this.defaults.style,n.weight=t.font.weight||this.defaults.weight,t.font.family?(n.family=t.font.family,n.family!==this.defaults.family&&(n.family+=", "+this.defaults.family)):n.family=this.defaults.family,n.transform=t.font.transform,n.size=t.font.size||this.defaults.size,n.px_size=u.StyleParser.evalCachedProperty(t.font.px_size,r),t.font.stroke&&t.font.stroke.color&&(n.stroke=o.default.toCSSColor(u.StyleParser.evalCachedColorProperty(t.font.stroke.color,r)||this.defaults.stroke),n.stroke_width=u.StyleParser.evalCachedProperty(t.font.stroke.width,r)||this.defaults.stroke_width),n.font_css=this.fontCSS(n);var i=t.text_wrap;return null==i&&"line"!==l.default.geometryType(e.geometry.type)&&(i=!0),i===!0&&(i=this.defaults.text_wrap),n.text_wrap=i,n.max_lines=t.max_lines||this.defaults.max_lines,n},fontCSS:function(e){var t=e.style,r=e.weight,n=e.px_size,i=e.family;return[t,r,n+"px",i].filter(function(e){return e}).join(" ")}}},{"../../geo":299,"../../utils/utils":358,"../style_parser":340}],346:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(r,"__esModule",{value:!0});var i=e("babel-runtime/core-js/get-iterator"),a=n(i),o=e("babel-runtime/core-js/promise"),s=n(o),l=e("babel-runtime/core-js/object/keys"),u=n(l),c=e("babel-runtime/core-js/json/stringify"),f=n(c),h=e("babel-runtime/helpers/toConsumableArray"),d=n(h),p=e("babel-runtime/helpers/classCallCheck"),m=n(p),_=e("babel-runtime/helpers/createClass"),g=n(_),v=e("./utils/log"),y=n(v),b=e("./geo"),x=n(b),w=e("./styles/style_parser"),k=e("./styles/style_manager"),A=e("./labels/collision"),T=n(A),E=e("./utils/worker_broker"),S=n(E),R=e("./gl/texture"),j=n(R),M=e("./utils/gl-matrix"),z=function(){function e(t){var r=t.coords,n=t.style_zoom,i=t.source,a=t.worker,o=t.view;m.default(this,e),this.worker=a,this.view=o,this.source=i,this.generation=null,this.visible=!1,this.proxy_for=null,this.proxy_depth=0,this.proxied_as=null,this.fade_in=!0,this.loading=!1,this.loaded=!1,this.built=!1,this.error=null,this.debug={},this.coords=e.coordinateWithMaxZoom(r,this.source.max_zoom),this.style_zoom=n,this.overzoom=Math.max(this.style_zoom-this.coords.z,0),this.overzoom2=Math.pow(2,this.overzoom),this.key=e.key(this.coords,this.source,this.style_zoom),this.min=x.default.metersForTile(this.coords),this.max=x.default.metersForTile({x:this.coords.x+1,y:this.coords.y+1,z:this.coords.z}),this.span={x:this.max.x-this.min.x,y:this.max.y-this.min.y},this.bounds={sw:{x:this.min.x,y:this.max.y},ne:{x:this.max.x,y:this.min.y}},this.center_dist=0,this.meters_per_pixel=x.default.metersPerPixel(this.style_zoom),this.meters_per_pixel_sq=this.meters_per_pixel*this.meters_per_pixel,this.units_per_pixel=x.default.units_per_pixel/this.overzoom2,this.units_per_meter_overzoom=x.default.unitsPerMeter(this.coords.z)*this.overzoom2,this.meshes={},this.textures=[],this.previous_textures=[],this.new_mesh_styles=[]}return g.default(e,[{key:"freeResources",value:function(){for(var e in this.meshes)this.meshes[e].destroy();this.meshes={},this.textures.forEach(function(e){return j.default.release(e)}),this.textures=[],this.previous_textures.forEach(function(e){return j.default.release(e)}),this.previous_textures=[]}},{key:"destroy",value:function(){this.workerMessage("self.removeTile",this.key),this.freeResources(),this.worker=null}},{key:"buildAsMessage",value:function(){return{key:this.key,source:this.source.name,coords:this.coords,min:this.min,max:this.max,units_per_pixel:this.units_per_pixel,meters_per_pixel:this.meters_per_pixel,meters_per_pixel_sq:this.meters_per_pixel_sq,units_per_meter_overzoom:this.units_per_meter_overzoom,style_zoom:this.style_zoom,overzoom:this.overzoom,overzoom2:this.overzoom2,generation:this.generation,debug:this.debug}}},{key:"workerMessage",value:function(){for(var e=arguments.length,t=Array(e),r=0;e>r;r++)t[r]=arguments[r];return S.default.postMessage.apply(S.default,[this.worker].concat(t))}},{key:"build",value:function(e){var t=arguments.length<=1||void 0===arguments[1]?{}:arguments[1],r=t.fade_in,n=void 0===r?!0:r;return this.generation=e,this.fade_in=n,this.loaded||(this.loading=!0,this.built=!1),this.workerMessage("self.buildTile",{tile:this.buildAsMessage()}).catch(function(e){throw e})}},{key:"buildMeshes",value:function(e,t){var r;if(!this.error){this.debug.geometries=0,this.debug.buffer_size=0;var n={},i=[],a=this.mesh_data;if(a)for(var o in a){if(a[o].vertex_data){if(this.debug.buffer_size+=a[o].vertex_data.byteLength,a[o].vertex_elements&&(this.debug.buffer_size+=a[o].vertex_elements.byteLength),!e[o]){y.default("warn","Could not create mesh because style '"+o+"' not found, for tile "+this.key+", aborting tile");break}n[o]=e[o].makeMesh(a[o].vertex_data,a[o].vertex_elements,a[o]),this.debug.geometries+=n[o].geometry_count}a[o].textures&&i.push.apply(i,d.default(a[o].textures))}delete this.mesh_data,t.start&&(this.new_mesh_styles=[],this.previous_textures=[].concat(d.default(this.textures)),this.textures=[]);for(var s in n)this.meshes[s]&&this.meshes[s].destroy(),this.meshes[s]=n[s],this.new_mesh_styles.push(s);if((r=this.textures).push.apply(r,i),t.done){for(var l in this.meshes)-1===this.new_mesh_styles.indexOf(l)&&this.meshes[l].destroy();this.new_mesh_styles=[],this.previous_textures.forEach(function(e){return j.default.release(e)}),this.previous_textures=[],this.debug.geom_ratio=(this.debug.geometries/this.debug.features).toFixed(1),this.printDebug()}}}},{key:"update",value:function(){var t=this.coords;t.z!==this.view.center.tile.z&&(t=e.coordinateAtZoom(t,this.view.center.tile.z)),this.center_dist=Math.abs(this.view.center.tile.x-t.x)+Math.abs(this.view.center.tile.y-t.y)}},{key:"setProxyFor",value:function(e){e?(this.visible=!0,this.proxy_for=this.proxy_for||[],this.proxy_for.push(e),this.proxy_depth=1,e.proxied_as=e.style_zoom>this.style_zoom?"child":"parent",this.update()):(this.proxy_for=null,this.proxy_depth=0)}},{key:"shouldProxyForStyle",value:function(e){return!this.proxy_for||this.proxy_for.some(function(t){return null==t.meshes[e]})}},{key:"setupProgram",value:function(e,t){var r=e.model,n=e.model32;t.uniform("4fv","u_tile_origin",[this.min.x,this.min.y,this.style_zoom,this.coords.z]),t.uniform("1f","u_tile_proxy_depth",this.proxy_depth),M.mat4.identity(r),M.mat4.translate(r,r,M.vec3.fromValues(this.min.x,this.min.y,0)),M.mat4.scale(r,r,M.vec3.fromValues(this.span.x/x.default.tile_scale,-1*this.span.y/x.default.tile_scale,1)),M.mat4.copy(n,r),t.uniform("Matrix4fv","u_model",n),t.uniform("1i","u_fade_in",this.fade_in&&"child"!==this.proxied_as)}},{key:"merge",value:function(e){for(var t in e)"key"!==t&&(this[t]=e[t]);return this}},{key:"printDebug",value:function(){y.default("debug","Tile: debug for "+this.key+": [ "+f.default(this.debug)+" ]")}}],[{key:"create",value:function(t){return new e(t)}},{key:"coord",value:function(t){return{x:t.x,y:t.y,z:t.z,key:e.coordKey(t)}}},{key:"coordKey",value:function(e){var t=e.x,r=e.y,n=e.z;return t+"/"+r+"/"+n}},{key:"key",value:function(t,r,n){return t=e.coordinateWithMaxZoom(t,r.max_zoom),t.y<0||t.y>=1<<t.z||t.z<0?void 0:[r.name,n,t.x,t.y,t.z].join("/")}},{key:"coordinateAtZoom",value:function(t,r){{var n=t.x,i=t.y,a=t.z;t.key}if(a!==r){var o=Math.pow(2,a-r);n=Math.floor(n/o),i=Math.floor(i/o),a=r}return e.coord({x:n,y:i,z:a})}},{key:"coordinateWithMaxZoom",value:function(t,r){var n=t.x,i=t.y,a=t.z;return void 0!==r&&a>r?e.coordinateAtZoom({x:n,y:i,z:a},r):e.coord({x:n,y:i,z:a})}},{key:"childrenForCoordinate",value:function(t){var r=t.x,n=t.y,i=t.z,a=t.key;return e.coord_children[a]||(i++,r*=2,n*=2,e.coord_children[a]=[e.coord({x:r,y:n,z:i}),e.coord({x:r+1,y:n,z:i}),e.coord({x:r,y:n+1,z:i}),e.coord({x:r+1,y:n+1,z:i})]),e.coord_children[a]}},{key:"isDescendant",value:function(t,r){if(r.z>t.z){var n=e.coordinateAtZoom(r,t.z),i=n.x,a=n.y;return t.x===i&&t.y===a}return!1}},{key:"sort",value:function(e){return e.sort(function(e,t){var r=e.center_dist,n=t.center_dist;return n>r?-1:n===r?0:1})}},{key:"cancel",value:function(t){t&&(t.canceled=!0,t.source_data&&t.source_data.request&&t.source_data.request.abort(),e.abortBuild(t))}},{key:"buildGeometry",value:function(t,r){var n=r.scene_id,i=r.layers,a=r.styles,o=r.global;t.debug.rendering=+new Date,t.debug.features=0;var s=t.source_data;T.default.startTile(t.key);for(var l in i){var u=i[l];if(u&&u.config.data){if(u.config.data.source===t.source)for(var c=e.getDataForSource(s,u.config.data,l),f=0;f<c.length;f++){var h=c[f],d=h.geom;if(d)for(var p=0;p<d.features.length;p++){var m=d.features[p];if(null!=m.geometry){var _=w.StyleParser.getFeatureParseContext(m,t,o);_.winding=t.default_winding,_.source=t.source,_.layer=h.layer;var g=u.buildDrawGroups(_,!0);if(g){for(var v in g){var b=g[v];if(b.visible){var x=b.style||v,A=a[x];A?(_.layers=b.layers,A.addFeature(m,b,_)):y.default("warn","Style '"+x+"' not found, skipping layer '"+l+"':",b,m)}}t.debug.features++}}}}}else y.default("warn","Layer "+l+" was defined without a geometry data source and will not be rendered.")}t.debug.rendering=+new Date-t.debug.rendering;var E=k.StyleManager.stylesForTile(t.key,a).map(function(e){return a[e]});e.sendStyleGroups(t,E,{scene_id:n},function(e){return e.collision?"collision":"non-collision"})}},{key:"sendStyleGroups",value:function(t,r,n,i){var a=n.scene_id,o={};r.forEach(function(e){var t=i(e);o[t]=o[t]||[],o[t].push(e)}),u.default(o).length>0?!function(){var r={start:!0};t.mesh_data={};var n=function(n){var i=o[n];s.default.all(i.map(function(e){return e.endData(t).then(function(r){r&&(t.mesh_data[e.name]={vertex_data:r.vertex_data,vertex_elements:r.vertex_elements,uniforms:r.uniforms,textures:r.textures})})})).then(function(){y.default("trace","Finished style group '"+n+"' for tile "+t.key),o[n]=[],u.default(o).every(function(e){return 0===o[e].length})&&(r.done=!0),S.default.postMessage("TileManager_"+a+".buildTileStylesCompleted",S.default.withTransferables({tile:e.slice(t,["mesh_data"]),progress:r})),r.start=null,t.mesh_data={},r.done&&T.default.resetTile(t.key)})};for(var i in o)n(i)}():(S.default.postMessage("TileManager_"+a+".buildTileStylesCompleted",S.default.withTransferables({tile:e.slice(t),progress:{start:!0,done:!0}})),T.default.resetTile(t.key))}},{key:"getDataForSource",value:function(e,t){var r=arguments.length<=2||void 0===arguments[2]?null:arguments[2],n=[];return null!=t&&(!t.layer&&e.layers._default?n.push({geom:e.layers._default}):!t.layer&&r?n.push({layer:r,geom:e.layers[r]}):"string"==typeof t.layer?n.push({layer:t.layer,geom:e.layers[t.layer]}):Array.isArray(t.layer)&&t.layer.forEach(function(t){e.layers[t]&&e.layers[t].features&&n.push({layer:t,geom:e.layers[t]})})),n}},{key:"abortBuild",value:function(e){if(e.mesh_data)for(var t in e.mesh_data){var r=e.mesh_data[t].textures;if(r){var n=!0,i=!1,o=void 0;try{for(var s,l=a.default(r);!(n=(s=l.next()).done);n=!0){var u=s.value,c=j.default.textures[u];c&&(y.default("trace","releasing texture "+u+" for tile "+e.key),c.release())}}catch(f){i=!0,o=f}finally{try{!n&&l.return&&l.return()}finally{if(i)throw o}}}}}},{key:"slice",value:function(e,t){var r=["key","loading","loaded","generation","error","debug"];Array.isArray(t)&&r.push.apply(r,d.default(t));var n={},i=!0,o=!1,s=void 0;try{for(var l,u=a.default(r);!(i=(l=u.next()).done);i=!0){var c=l.value;n[c]=e[c]}}catch(f){o=!0,s=f}finally{try{!i&&u.return&&u.return()}finally{if(o)throw s}}return n}}]),e}();r.default=z,z.coord_children={}},{"./geo":299,"./gl/texture":306,"./labels/collision":312,"./styles/style_manager":339,"./styles/style_parser":340,"./utils/gl-matrix":351,"./utils/log":352,"./utils/worker_broker":360,"babel-runtime/core-js/get-iterator":4,"babel-runtime/core-js/json/stringify":6,"babel-runtime/core-js/object/keys":15,"babel-runtime/core-js/promise":17,"babel-runtime/helpers/classCallCheck":21,"babel-runtime/helpers/createClass":22,"babel-runtime/helpers/toConsumableArray":28}],347:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(r,"__esModule",{value:!0});var i=e("babel-runtime/core-js/get-iterator"),a=n(i),o=e("babel-runtime/core-js/object/keys"),s=n(o),l=e("babel-runtime/helpers/classCallCheck"),u=n(l),c=e("babel-runtime/helpers/createClass"),f=n(c),h=e("./tile"),d=n(h),p=e("./tile_pyramid"),m=n(p),_=e("./utils/log"),g=n(_),v=e("./utils/worker_broker"),y=n(v),b=function(){function e(t){var r=t.scene,n=t.view;u.default(this,e),this.scene=r,this.view=n,this.tiles={},this.pyramid=new m.default,this.visible_coords={},this.queued_coords=[],this.building_tiles=null,this.main_thread_target=["TileManager",this.scene.id].join("_"),y.default.addTarget(this.main_thread_target,this)}return f.default(e,[{key:"destroy",value:function(){this.forEachTile(function(e){return e.destroy()}),this.tiles={},this.pyramid=null,this.visible_coords={},this.queued_coords=[],this.scene=null,this.view=null}},{key:"keepTile",value:function(e){this.tiles[e.key]=e,this.pyramid.addTile(e)}},{key:"hasTile",value:function(e){return void 0!==this.tiles[e]}},{key:"forgetTile",value:function(e){if(this.hasTile(e)){var t=this.tiles[e];this.pyramid.removeTile(t)}delete this.tiles[e],this.tileBuildStop(e)}},{key:"removeTile",value:function(e){g.default("trace","tile unload for "+e);var t=this.tiles[e];null!=t&&t.destroy(),this.forgetTile(t.key),this.scene.requestRedraw()}},{key:"forEachTile",value:function(e){for(var t in this.tiles)e(this.tiles[t])}},{key:"removeTiles",value:function(e){var t=[];for(var r in this.tiles){var n=this.tiles[r];e(n)&&t.push(r)}for(var i=0;i<t.length;i++){var a=t[i];this.removeTile(a)}}},{key:"updateTilesForView",value:function(){var e=s.default(this.visible_coords);this.visible_coords={};var t=this.view.findVisibleTileCoordinates(),r=!0,n=!1,i=void 0;try{for(var o,l=a.default(t);!(r=(o=l.next()).done);r=!0){var u=o.value;this.queueCoordinate(u),this.visible_coords[u.key]=u}}catch(c){n=!0,i=c}finally{try{!r&&l.return&&l.return()}finally{if(n)throw i}}var f=s.default(this.visible_coords),h=!1;e.length!==f.length?h=!0:(e.sort(),f.sort(),e.every(function(e,t){return f[t]===e})||(h=!0)),this.updateTileStates()}},{key:"updateTileStates",value:function(){var e=this;this.forEachTile(function(t){e.updateVisibility(t),t.update()}),this.loadQueuedCoordinates(),this.updateProxyTiles(),this.view.pruneTilesForView()}},{key:"updateProxyTiles",value:function(){var e=this;if(0!==this.view.zoom_direction){this.forEachTile(function(e){return e.setProxyFor(null)});var t=!1;this.forEachTile(function(r){if(1===e.view.zoom_direction){if(r.visible&&!r.built&&r.coords.z>0){var n=e.pyramid.getAncestor(r);n&&(n.setProxyFor(r),t=!0)}}else if(-1===e.view.zoom_direction&&r.visible&&!r.built){var i=e.pyramid.getDescendants(r),o=!0,s=!1,l=void 0;try{for(var u,c=a.default(i);!(o=(u=c.next()).done);o=!0){var f=u.value;f.setProxyFor(r),t=!0}}catch(h){s=!0,l=h}finally{try{!o&&c.return&&c.return()}finally{if(s)throw l}}}}),t||(this.view.zoom_direction=0)}}},{key:"updateVisibility",value:function(e){if(e.visible=!1,e.style_zoom===this.view.tile_zoom)if(this.visible_coords[e.coords.key])e.visible=!0;else for(var t in this.visible_coords)if(d.default.isDescendant(e.coords,this.visible_coords[t])){e.visible=!0;break}}},{key:"pruneToVisibleTiles",value:function(){this.removeTiles(function(e){return!e.visible})}},{key:"getRenderableTiles",value:function(){var e=[];for(var t in this.tiles){var r=this.tiles[t];r.visible&&r.loaded&&e.push(r)}return e}},{key:"isLoadingVisibleTiles",value:function(){var e=this;return s.default(this.tiles).some(function(t){return e.tiles[t].visible&&!e.tiles[t].built})}},{key:"queueCoordinate",value:function(e){this.queued_coords[this.queued_coords.length]=e}},{key:"loadQueuedCoordinates",value:function(){var e=this;0!==this.queued_coords.length&&(this.queued_coords.sort(function(t,r){var n=Math.abs(e.view.center.tile.x-t.x)+Math.abs(e.view.center.tile.y-t.y),i=Math.abs(e.view.center.tile.x-r.x)+Math.abs(e.view.center.tile.y-r.y);return i>n?-1:i===n?0:1}),this.queued_coords.forEach(function(t){return e.loadCoordinate(t)}),this.queued_coords=[])}},{key:"loadCoordinate",value:function(e){if(e.z===this.view.center.tile.z)for(var t in this.scene.sources){var r=this.scene.sources[t];if(r.builds_geometry_tiles&&r.includesTile(e,this.view.tile_zoom)){var n=d.default.key(e,r,this.view.tile_zoom);if(n&&!this.hasTile(n)){var i=d.default.create({source:r,coords:e,worker:this.scene.nextWorker(),style_zoom:this.view.styleZoom(e.z),view:this.view});this.keepTile(i),this.buildTile(i)}}}}},{key:"buildTiles",value:function(e){var t=this;d.default.sort(e).forEach(function(e){return t.buildTile(e)}),this.checkBuildQueue()}},{key:"buildTile",value:function(e,t){this.tileBuildStart(e.key),this.updateVisibility(e),e.update(),e.build(this.scene.generation,t)}},{key:"buildTileStylesCompleted",value:function(e){var t=e.tile,r=e.progress;null==this.tiles[t.key]?(g.default("trace","discarded tile "+t.key+" in TileManager.buildTileStylesCompleted because previously removed"),d.default.abortBuild(t),this.updateTileStates()):t.generation!==this.scene.generation?(g.default("debug","discarded tile "+t.key+" in TileManager.buildTileStylesCompleted because built with "+("scene config gen "+t.generation+", current "+this.scene.generation)),d.default.abortBuild(t),this.updateTileStates()):(this.tiles[t.key]&&(t=this.tiles[t.key].merge(t)),r.done&&(t.built=!0),t.buildMeshes(this.scene.styles,r),this.updateTileStates(),this.scene.requestRedraw()),r.done&&this.tileBuildStop(t.key) 19 }},{key:"buildTileError",value:function(e){g.default("error","Error building tile "+e.key+":",e.error),this.forgetTile(e.key),d.default.abortBuild(e)}},{key:"tileBuildStart",value:function(e){this.building_tiles=this.building_tiles||{},this.building_tiles[e]=!0,g.default("trace","tileBuildStart for "+e+": "+s.default(this.building_tiles).length)}},{key:"tileBuildStop",value:function(e){this.building_tiles&&(g.default("trace","tileBuildStop for "+e+": "+s.default(this.building_tiles).length),delete this.building_tiles[e],this.checkBuildQueue())}},{key:"checkBuildQueue",value:function(){this.building_tiles&&0!==s.default(this.building_tiles).length||(this.building_tiles=null,this.scene.tileManagerBuildDone())}},{key:"getDebugSum",value:function(e,t){var r=0;for(var n in this.tiles)null==this.tiles[n].debug[e]||"function"==typeof t&&t(this.tiles[n])!==!0||(r+=this.tiles[n].debug[e]);return r}},{key:"getDebugAverage",value:function(e,t){return this.getDebugSum(e,t)/s.default(this.tiles).length}}]),e}();r.default=b},{"./tile":346,"./tile_pyramid":348,"./utils/log":352,"./utils/worker_broker":360,"babel-runtime/core-js/get-iterator":4,"babel-runtime/core-js/object/keys":15,"babel-runtime/helpers/classCallCheck":21,"babel-runtime/helpers/createClass":22}],348:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(r,"__esModule",{value:!0});var i=e("babel-runtime/helpers/toConsumableArray"),a=n(i),o=e("babel-runtime/core-js/get-iterator"),s=n(o),l=e("babel-runtime/core-js/map"),u=n(l),c=e("babel-runtime/helpers/classCallCheck"),f=n(c),h=e("babel-runtime/helpers/createClass"),d=n(h),p=e("./geo"),m=n(p),_=e("./tile"),g=n(_),v=function(){function e(){f.default(this,e),this.coords={},this.max_proxy_descendant_depth=3}return d.default(e,[{key:"sourceTiles",value:function(e,t){return this.coords[e.key]&&this.coords[e.key].sources&&this.coords[e.key].sources.get(t.name)}},{key:"addTile",value:function(e){var t=e.coords.key,r=this.coords[t];r||(r=this.coords[t]={descendants:0}),r.sources||(r.sources=new u.default),r.sources.get(e.source.name)||r.sources.set(e.source.name,new u.default),r.sources.get(e.source.name).set(e.style_zoom,e);for(var n=e.coords.z-1;n>=0;n--){var i=g.default.coordinateAtZoom(e.coords,n);this.coords[i.key]||(this.coords[i.key]={descendants:0}),this.coords[i.key].descendants++}}},{key:"removeTile",value:function(e){var t=this.sourceTiles(e.coords,e.source),r=e.coords.key;t&&(t.delete(e.style_zoom),0===t.size&&(this.coords[r].sources.delete(e.source.name),0===this.coords[r].sources.size&&(delete this.coords[r].sources,0===this.coords[r].descendants&&delete this.coords[r])));for(var n=e.coords.z-1;n>=0;n--){var i=g.default.coordinateAtZoom(e.coords,n);this.coords[i.key]&&this.coords[i.key].descendants>0&&(this.coords[i.key].descendants--,0!==this.coords[i.key].descendants||this.coords[i.key].sources||delete this.coords[i.key])}}},{key:"getAncestor",value:function(e){var t=e.coords,r=e.style_zoom,n=e.source;if(r>n.max_zoom){var i=this.sourceTiles(t,n);if(i)for(var a=r-1;a>=n.max_zoom;a--)if(i.has(a)&&i.get(a).loaded)return i.get(a);r=n.max_zoom}r--;var o=g.default.coordinateAtZoom(t,t.z-1),s=this.sourceTiles(o,n);return s&&s.has(r)&&s.get(r).loaded?s.get(r):o.z>0?this.getAncestor({coords:o,style_zoom:r,source:n}):void 0}},{key:"getDescendants",value:function(e){var t=e.coords,r=e.style_zoom,n=e.source,i=arguments.length<=1||void 0===arguments[1]?1:arguments[1],o=[];if(r>=n.max_zoom){var l=this.sourceTiles(t,n);if(l)for(var u=Math.max(m.default.default_view_max_zoom,r+this.max_proxy_descendant_depth),c=r+1;u>=c;c++)if(l.has(c)&&l.get(c).loaded)return o.push(l.get(c)),o;return o}if(this.coords[t.key]&&this.coords[t.key].descendants>0){r++;var f=!0,h=!1,d=void 0;try{for(var p,_=s.default(g.default.childrenForCoordinate(t));!(f=(p=_.next()).done);f=!0){var v=p.value,y=this.sourceTiles(v,n);y&&y.has(r)&&y.get(r).loaded?o.push(y.get(r)):i<=this.max_proxy_descendant_depth&&v.z<=n.max_zoom&&o.push.apply(o,a.default(this.getDescendants({coords:v,source:n,style_zoom:r},i+1)))}}catch(b){h=!0,d=b}finally{try{!f&&_.return&&_.return()}finally{if(h)throw d}}}return o}}]),e}();r.default=v},{"./geo":299,"./tile":346,"babel-runtime/core-js/get-iterator":4,"babel-runtime/core-js/map":7,"babel-runtime/helpers/classCallCheck":21,"babel-runtime/helpers/createClass":22,"babel-runtime/helpers/toConsumableArray":28}],349:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r.default={draw_label_collision_boxes:!1,draw_label_texture_boxes:!1,suppress_label_fade_in:!1}},{}],350:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(r,"__esModule",{value:!0}),r.MethodNotImplemented=void 0;{var i=e("babel-runtime/core-js/object/get-prototype-of"),a=n(i),o=e("babel-runtime/helpers/classCallCheck"),s=n(o),l=e("babel-runtime/helpers/possibleConstructorReturn"),u=n(l),c=e("babel-runtime/helpers/inherits"),f=n(c);r.MethodNotImplemented=function(e){function t(e){s.default(this,t);var r=u.default(this,a.default(t).call(this));return r.name="MethodNotImplemented",r.message="Method "+e+" must be implemented in subclass",r}return f.default(t,e),t}(Error)}},{"babel-runtime/core-js/object/get-prototype-of":14,"babel-runtime/helpers/classCallCheck":21,"babel-runtime/helpers/inherits":25,"babel-runtime/helpers/possibleConstructorReturn":26}],351:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(r,"__esModule",{value:!0}),r.mat4=r.mat3=r.vec3=void 0;var i=e("gl-mat3/normal-from-mat4"),a=n(i),o=e("gl-mat3/invert"),s=n(o),l=e("gl-mat4/multiply"),u=n(l),c=e("gl-mat4/translate"),f=n(c),h=e("gl-mat4/scale"),d=n(h),p=e("gl-mat4/perspective"),m=n(p),_=e("gl-mat4/lookAt"),g=n(_),v=e("gl-mat4/identity"),y=n(v),b=e("gl-mat4/copy"),x=n(b),w={fromValues:function(e,t,r){var n=new Float64Array(3);return n[0]=e,n[1]=t,n[2]=r,n}},k={normalFromMat4:a.default,invert:s.default},A={multiply:u.default,translate:f.default,scale:d.default,perspective:m.default,lookAt:g.default,identity:y.default,copy:x.default};r.vec3=w,r.mat3=k,r.mat4=A},{"gl-mat3/invert":176,"gl-mat3/normal-from-mat4":177,"gl-mat4/copy":178,"gl-mat4/identity":179,"gl-mat4/lookAt":180,"gl-mat4/multiply":181,"gl-mat4/perspective":182,"gl-mat4/scale":183,"gl-mat4/translate":184}],352:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function i(e){return f.default.is_main?(m[e]=m[e]||(console[e]?console[e]:console.log).bind(console),m[e]):void 0}function a(e){if(p[e]<=p[a.level]){for(var t=arguments.length,r=Array(t>1?t-1:0),n=1;t>n;n++)r[n-1]=arguments[n];if(f.default.is_worker)d.default.postMessage.apply(d.default,["_logProxy",e].concat(r));else{var o=i(e);r.length>1?o.apply(void 0,["Tangram "+u.default+" ["+e+"]: "+r[0]].concat(s.default(r.slice(1)))):o("Tangram "+u.default+" ["+e+"]: "+r[0])}}}Object.defineProperty(r,"__esModule",{value:!0});var o=e("babel-runtime/helpers/toConsumableArray"),s=n(o);r.default=a;var l=e("./version"),u=n(l),c=e("./thread"),f=n(c),h=e("./worker_broker"),d=n(h),p={silent:-1,error:0,warn:1,info:2,debug:3,trace:4},m={};a.level="info",a.workers=null,a.setLevel=function(e){a.level=e,f.default.is_main&&Array.isArray(a.workers)&&d.default.postMessage(a.workers,"_logSetLevelProxy",e)},f.default.is_main&&(a.setWorkers=function(e){a.workers=e}),d.default.addTarget("_logProxy",a),d.default.addTarget("_logSetLevelProxy",a.setLevel)},{"./thread":357,"./version":359,"./worker_broker":360,"babel-runtime/helpers/toConsumableArray":28}],353:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(r,"__esModule",{value:!0});var i=e("babel-runtime/core-js/promise"),a=n(i),o=e("babel-runtime/helpers/classCallCheck"),s=n(o),l=e("babel-runtime/helpers/createClass"),u=n(l),c=e("./log"),f=n(c),h=e("./utils"),d=n(h),p=function(){function e(){s.default(this,e),this.queue_screenshot=null,this.video_capture=null}return u.default(e,[{key:"setCanvas",value:function(e){this.canvas=e}},{key:"screenshot",value:function(){var e=this;return null!=this.queue_screenshot?this.queue_screenshot.promise:(this.queue_screenshot={},this.queue_screenshot.promise=new a.default(function(t,r){e.queue_screenshot.resolve=t,e.queue_screenshot.reject=r}),this.queue_screenshot.promise)}},{key:"completeScreenshot",value:function(){if(null!=this.queue_screenshot){for(var e=this.canvas.toDataURL("image/png"),t=atob(e.slice(22)),r=new Uint8Array(t.length),n=0;n<t.length;++n)r[n]=t.charCodeAt(n);var i=new Blob([r],{type:"image/png"});this.queue_screenshot.resolve({url:e,blob:i,type:"png"}),this.queue_screenshot=null}}},{key:"startVideoCapture",value:function(){var e=this;if("function"!=typeof window.MediaRecorder||!this.canvas||"function"!=typeof this.canvas.captureStream)return f.default("warn","Video capture (Canvas.captureStream and/or MediaRecorder APIs) not supported by browser"),!1;if(this.video_capture)return f.default("warn","Video capture already in progress, call Scene.stopVideoCapture() first"),!1;try{!function(){var t=e.video_capture={};t.chunks=[],t.stream=e.canvas.captureStream(),t.options={mimeType:"video/webm"},t.media_recorder=new MediaRecorder(t.stream,t.options),t.media_recorder.ondataavailable=function(r){if(r.data.size>0&&t.chunks.push(r.data),t.resolve){var n=new Blob(t.chunks,{type:t.options.mimeType}),i=d.default.createObjectURL(n);if(t.stream){var a=t.stream.getTracks()||[];a.forEach(function(e){e.stop(),t.stream.removeTrack(e)})}t.stream=null,t.media_recorder=null,e.video_capture=null,t.resolve({url:i,blob:n,type:"webm"})}},t.media_recorder.start()}()}catch(t){return this.video_capture=null,f.default("error","Scene video capture failed",t),!1}return!0}},{key:"stopVideoCapture",value:function(){var e=this;return this.video_capture?(this.video_capture.promise=new a.default(function(t,r){e.video_capture.resolve=t,e.video_capture.reject=r}),this.video_capture.media_recorder.stop(),this.video_capture.promise):(f.default("warn","No scene video capture in progress, call Scene.startVideoCapture() first"),a.default.resolve({}))}}]),e}();r.default=p},{"./log":352,"./utils":358,"babel-runtime/core-js/promise":17,"babel-runtime/helpers/classCallCheck":21,"babel-runtime/helpers/createClass":22}],354:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function i(e){for(var t=arguments.length,r=Array(t>1?t-1:0),n=1;t>n;n++)r[n-1]=arguments[n];for(var a=0;a<r.length;a++){var s=r[a];if(s)for(var l in s){var u=s[l];null===u||"object"!==("undefined"==typeof u?"undefined":o.default(u))||Array.isArray(u)?void 0!==u&&(e[l]=u):e[l]=null===e[l]||"object"!==o.default(e[l])||Array.isArray(e[l])?i({},u):i(e[l],u)}}return e}Object.defineProperty(r,"__esModule",{value:!0});var a=e("babel-runtime/helpers/typeof"),o=n(a);r.default=i},{"babel-runtime/helpers/typeof":29}],355:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(r,"__esModule",{value:!0});var i=e("babel-runtime/helpers/classCallCheck"),a=n(i),o=e("babel-runtime/helpers/createClass"),s=n(o),l=e("../vector"),u=n(l),c=function(){function e(t,r,n,i,o){a.default(this,e),this.dimension=[i,o],this.angle=n,this.centroid=[t,r],this.quad=[],this.axes=[],this.update()}return s.default(e,[{key:"move",value:function(e,t){this.centroid=[e,t],this.update()}},{key:"getExtent",value:function(){for(var e=1e6,t=[e,e,-e,-e],r=0;4>r;++r)t[0]=Math.min(this.quad[r][0],t[0]),t[1]=Math.min(this.quad[r][1],t[1]),t[2]=Math.max(this.quad[r][0],t[2]),t[3]=Math.max(this.quad[r][1],t[3]);return t}},{key:"perpAxes",value:function(){this.axes[0]=u.default.normalize(u.default.sub(this.quad[2],this.quad[3])),this.axes[1]=u.default.normalize(u.default.sub(this.quad[2],this.quad[1]))}},{key:"update",value:function(){var e=[Math.cos(this.angle),Math.sin(this.angle)],t=[-Math.sin(this.angle),Math.cos(this.angle)];e=u.default.mult(e,this.dimension[0]/2),t=u.default.mult(t,this.dimension[1]/2),this.quad[0]=u.default.sub(u.default.sub(this.centroid,e),t),this.quad[1]=u.default.sub(u.default.add(this.centroid,e),t),this.quad[2]=u.default.add(u.default.add(this.centroid,e),t),this.quad[3]=u.default.add(u.default.sub(this.centroid,e),t),this.perpAxes()}}],[{key:"projectToAxis",value:function(e,t){for(var r=1e6,n=r,i=-r,a=e.quad,o=0;4>o;++o){var s=u.default.dot(a[o],t);n=Math.min(n,s),i=Math.max(i,s)}return[n,i]}},{key:"axisCollide",value:function(t,r,n){for(var i=0;2>i;++i){var a=e.projectToAxis(t,n[i]),o=e.projectToAxis(r,n[i]);if(o[0]>a[1]||o[1]<a[0])return!1}return!0}},{key:"intersect",value:function(t,r){return e.axisCollide(t,r,t.axes)&&e.axisCollide(t,r,r.axes)}}]),e}();r.default=c},{"../vector":361,"babel-runtime/helpers/classCallCheck":21,"babel-runtime/helpers/createClass":22}],356:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function i(e){var t=new c.default;return l.default(e,{subscribe:function(e){t.add(e)},unsubscribe:function(e){t.delete(e)},unsubscribeAll:function(){t.clear()},trigger:function(e){for(var r=arguments.length,n=Array(r>1?r-1:0),i=1;r>i;i++)n[i-1]=arguments[i];var a=!0,s=!1,l=void 0;try{for(var u,c=o.default(t);!(a=(u=c.next()).done);a=!0){var f=u.value;"function"==typeof f[e]&&f[e].apply(f,n)}}catch(h){s=!0,l=h}finally{try{!a&&c.return&&c.return()}finally{if(s)throw l}}},hasSubscribersFor:function(e){var r=!0,n=!1,i=void 0;try{for(var a,s=o.default(t);!(r=(a=s.next()).done);r=!0){var l=a.value;if("function"==typeof l[e])return!0}}catch(u){n=!0,i=u}finally{try{!r&&s.return&&s.return()}finally{if(n)throw i}}return!1}})}Object.defineProperty(r,"__esModule",{value:!0});var a=e("babel-runtime/core-js/get-iterator"),o=n(a),s=e("babel-runtime/core-js/object/assign"),l=n(s),u=e("babel-runtime/core-js/set"),c=n(u);r.default=i},{"babel-runtime/core-js/get-iterator":4,"babel-runtime/core-js/object/assign":9,"babel-runtime/core-js/set":18}],357:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n={};r.default=n;try{window.document!==HTMLDocument&&(n.is_worker=!1,n.is_main=!0)}catch(i){void 0!==self&&(n.is_worker=!0,n.is_main=!1,self.window={document:{}},self.document=self.window.document)}},{}],358:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(r,"__esModule",{value:!0});var i,a=e("babel-runtime/regenerator"),o=n(a),s=e("babel-runtime/core-js/math/log2"),l=n(s),u=e("babel-runtime/core-js/get-iterator"),c=n(u),f=e("babel-runtime/helpers/toConsumableArray"),h=n(f),d=e("babel-runtime/helpers/typeof"),p=n(d),m=e("babel-runtime/core-js/json/stringify"),_=n(m),g=e("babel-runtime/core-js/promise"),v=n(g),y=e("babel-runtime/core-js/object/keys"),b=n(y),x=e("./thread"),w=n(x),k=e("./log"),A=n(k),T=e("../geo"),E=n(T),S=e("js-yaml"),R=n(S);r.default=i={},i.addBaseURL=function(e,t){if(e){if("//"===e.substr(0,2))e=window.location.protocol+e;else if(e.search(/^(http|https|data|blob):/)<0){var r,n="/"!==e[0];if(t?(r=document.createElement("a"),r.href=t):r=window.location,n){var a=i.pathForURL(r.href);e=a+e}else if(r.origin)e=r.origin+"/"+e;else{var o=e.match(/^((http|https|data|blob):\/\/[^\/]*\/)/);o=o&&o.length>1?o[0]:"",e=o+e}}return e}},i.pathForURL=function(e){if("string"==typeof e&&-1===e.search(/^(data|blob):/)){var t=e.indexOf("?");t>-1&&(e=e.substr(0,t));var r=e.indexOf("#");return r>-1&&(e=e.substr(0,r)),e.substr(0,e.lastIndexOf("/")+1)||""}return""},i.isRelativeURL=function(e){return"string"==typeof e?!(e.search(/^(http|https|data|blob):/)>-1||"//"===e.substr(0,2)):void 0},i.flattenRelativeURL=function(e){for(var t=(e||"").split("/"),r=1;r<t.length;r++)"."===t[r]?(t.splice(r,1),r--):".."===t[r]&&(r+=0,t.splice(r-1,2),r--);return t.join("/")},i.extensionForURL=function(e){e=e.split("/").pop();var t=e.lastIndexOf(".");return t>-1?e.substring(t+1):void 0},i.addParamsToURL=function(e,t){if(!t||0===b.default(t).length)return e;var r=e.indexOf("?"),n=e.indexOf("#"),i="";n>-1&&(i=e.slice(n),e=e.slice(0,n)),-1===r&&(r=e.length,e+="?"),r++;var a="";for(var o in t)a+=o+"="+t[o]+"&";return e=e.slice(0,r)+a+e.slice(r)+i},i.isSafari=function(){return/^((?!chrome|android).)*safari/i.test(navigator.userAgent)},i._createObjectURL=void 0,i.createObjectURL=function(e){return void 0===i._createObjectURL&&(i._createObjectURL=window.URL&&window.URL.createObjectURL||window.webkitURL&&window.webkitURL.createObjectURL,"function"!=typeof i._createObjectURL&&(i._createObjectURL=null,A.default("warn","window.URL.createObjectURL (or vendor prefix) not found, unable to create local blob URLs"))),i._createObjectURL?i._createObjectURL(e):e},i.io=function(e){var t=arguments.length<=1||void 0===arguments[1]?6e4:arguments[1],r=arguments.length<=2||void 0===arguments[2]?"text":arguments[2],n=arguments.length<=3||void 0===arguments[3]?"GET":arguments[3],i=(arguments.length<=4||void 0===arguments[4]?{}:arguments[4],new XMLHttpRequest),a=new v.default(function(a,o){i.open(n,e,!0),i.timeout=t,i.responseType=r,i.onload=function(){200===i.status?a(["text","json"].indexOf(i.responseType)>-1?i.responseText:i.response):o(Error("Request error with a status of "+i.statusText))},i.onerror=function(e){o(Error("There was a network error"+e.toString()))},i.ontimeout=function(e){o(Error("timeout "+e.toString()))},i.send()});return Object.defineProperty(a,"request",{value:i}),a},i.parseResource=function(e){var t;try{t=R.default.safeLoad(e,{json:!0})}catch(r){throw r}return t},i.loadResource=function(e){return new v.default(function(t,r){"string"==typeof e?i.io(e).then(function(e){try{var n=i.parseResource(e);t(n)}catch(a){r(a)}},r):t(e)})},i.requestAnimationFramePolyfill=function(){"function"!=typeof window.requestAnimationFrame&&(window.requestAnimationFrame=window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||function(e){setTimeout(e,1e3/60)})},i.serializeWithFunctions=function(e){var t=_.default(e,function(e,t){return"function"==typeof t?t.toString():t});return t},i.stringsToFunctions=function(e,t){if("string"==typeof e)e=i.stringToFunction(e,t);else if(null!=e&&"object"===("undefined"==typeof e?"undefined":p.default(e)))for(var r in e)e[r]=i.stringsToFunctions(e[r],t);return e},i.stringToFunction=function(e,t){var r="string"==typeof e&&e.match(/^\s*function[^(]*\(([^)]*)\)\s*?\{([\s\S]*)\}$/m);if(r&&r.length>2)try{var n=r[2],i=r[1].length>0&&r[1].split(",").map(function(e){return e.trim()}).filter(function(e){return e});return i=i.length>0?i:["context"],"function"==typeof t?new(Function.prototype.bind.apply(Function,[null].concat(h.default(i),[t(n)]))):new(Function.prototype.bind.apply(Function,[null].concat(h.default(i),[n])))}catch(a){return e}return e},i.use_high_density_display=!0,i.updateDevicePixelRatio=function(){var e=i.device_pixel_ratio;return i.device_pixel_ratio=i.use_high_density_display&&window.devicePixelRatio||1,i.device_pixel_ratio!==e},w.default.is_main&&i.updateDevicePixelRatio(),i.findCurrentURL=function(){for(var e=document.currentScript,t=arguments.length,r=Array(t),n=0;t>n;n++)r[n]=arguments[n];if(e)return e.src;if(Array.isArray(r))for(var i=document.getElementsByTagName("script"),a=0;a<i.length;a++){var o=!0,s=!1,l=void 0;try{for(var u,f=c.default(r);!(o=(u=f.next()).done);o=!0){var h=u.value;if(i[a].src.indexOf(h)>-1)return i[a].src}}catch(d){s=!0,l=d}finally{try{!o&&f.return&&f.return()}finally{if(s)throw l}}}},i.isPowerOf2=function(e){return 0===(e&e-1)},i.nextPowerOf2=function(e){return Math.pow(2,Math.ceil(l.default(e)))},i.interpolate=function(e,t,r){if(!Array.isArray(t)||!Array.isArray(t[0]))return t;if(t.length<1)return t;var n,i,a,o,s,l;if(e<=t[0][0])o=t[0][1],"function"==typeof r&&(o=r(o));else if(e>=t[t.length-1][0])o=t[t.length-1][1],"function"==typeof r&&(o=r(o));else for(var u=0;u<t.length-1;u++)if(e>=t[u][0]&&e<t[u+1][0]){if(n=t[u][0],i=t[u+1][0],Array.isArray(t[u][1])){o=[];for(var c=0;c<t[u][1].length;c++)"function"==typeof r?(s=r(t[u][1][c]),l=r(t[u+1][1][c]),a=l-s,o[c]=a*(e-n)/(i-n)+s):(a=t[u+1][1][c]-t[u][1][c],o[c]=a*(e-n)/(i-n)+t[u][1][c])}else"function"==typeof r?(s=r(t[u][1]),l=r(t[u+1][1]),a=l-s,o=a*(e-n)/(i-n)+s):(a=t[u+1][1]-t[u][1],o=a*(e-n)/(i-n)+t[u][1]);break}return o},i.entries=o.default.mark(function j(e){var t,r,n,i,a,s;return o.default.wrap(function(o){for(;;)switch(o.prev=o.next){case 0:t=!0,r=!1,n=void 0,o.prev=3,i=c.default(b.default(e));case 5:if(t=(a=i.next()).done){o.next=12;break}return s=a.value,o.next=9,[s,e[s]];case 9:t=!0,o.next=5;break;case 12:o.next=18;break;case 14:o.prev=14,o.t0=o["catch"](3),r=!0,n=o.t0;case 18:o.prev=18,o.prev=19,!t&&i.return&&i.return();case 21:if(o.prev=21,!r){o.next=24;break}throw n;case 24:return o.finish(21);case 25:return o.finish(18);case 26:case"end":return o.stop()}},j,this,[[3,14,18,26],[19,,21,25]])}),i.values=o.default.mark(function M(e){var t,r,n,i,a,s;return o.default.wrap(function(o){for(;;)switch(o.prev=o.next){case 0:t=!0,r=!1,n=void 0,o.prev=3,i=c.default(b.default(e));case 5:if(t=(a=i.next()).done){o.next=12;break}return s=a.value,o.next=9,e[s];case 9:t=!0,o.next=5;break;case 12:o.next=18;break;case 14:o.prev=14,o.t0=o["catch"](3),r=!0,n=o.t0;case 18:o.prev=18,o.prev=19,!t&&i.return&&i.return();case 21:if(o.prev=21,!r){o.next=24;break}throw n;case 24:return o.finish(21);case 25:return o.finish(18);case 26:case"end":return o.stop()}},M,this,[[3,14,18,26],[19,,21,25]])}),i.recurseEntries=o.default.mark(function z(e){var t,r,n,a,s,l;return o.default.wrap(function(o){for(;;)switch(o.prev=o.next){case 0:if(e){o.next=2;break}return o.abrupt("return");case 2:t=!0,r=!1,n=void 0,o.prev=5,a=c.default(b.default(e));case 7:if(t=(s=a.next()).done){o.next=17;break}if(l=s.value,!e[l]){o.next=14;break}return o.next=12,[l,e[l],e];case 12:if("object"!==p.default(e[l])){o.next=14;break}return o.delegateYield(i.recurseEntries(e[l]),"t0",14);case 14:t=!0,o.next=7;break;case 17:o.next=23;break;case 19:o.prev=19,o.t1=o["catch"](5),r=!0,n=o.t1;case 23:o.prev=23,o.prev=24,!t&&a.return&&a.return();case 26:if(o.prev=26,!r){o.next=29;break}throw n;case 29:return o.finish(26);case 30:return o.finish(23);case 31:case"end":return o.stop()}},z,this,[[5,19,23,31],[24,,26,30]])}),i.recurseValues=o.default.mark(function C(e){var t,r,n,a,s,l;return o.default.wrap(function(o){for(;;)switch(o.prev=o.next){case 0:if(e){o.next=2;break}return o.abrupt("return");case 2:t=!0,r=!1,n=void 0,o.prev=5,a=c.default(b.default(e));case 7:if(t=(s=a.next()).done){o.next=17;break}if(l=s.value,!e[l]){o.next=14;break}return o.next=12,e[l];case 12:if("object"!==p.default(e[l])){o.next=14;break}return o.delegateYield(i.recurseValues(e[l]),"t0",14);case 14:t=!0,o.next=7;break;case 17:o.next=23;break;case 19:o.prev=19,o.t1=o["catch"](5),r=!0,n=o.t1;case 23:o.prev=23,o.prev=24,!t&&a.return&&a.return();case 26:if(o.prev=26,!r){o.next=29;break}throw n;case 29:return o.finish(26);case 30:return o.finish(23);case 31:case"end":return o.stop()}},C,this,[[5,19,23,31],[24,,26,30]])}),i.radToDeg=function(e){return 180*e/Math.PI},i.toCSSColor=function(e){return 1===e[3]?"rgb("+e.slice(0,3).map(function(e){return Math.round(255*e)}).join(", ")+")":"rgba("+e.map(function(e,t){return 3>t&&Math.round(255*e)||e}).join(", ")+")"},i.pointInTile=function(e){return e[0]>=0&&e[1]>-E.default.tile_scale&&e[0]<E.default.tile_scale&&e[1]<=0},i.hashString=function(e){if(0===e.length)return 0;for(var t=0,r=0,n=e.length;n>r;r++){var i=e.charCodeAt(r);t=(t<<5)-t+i,t|=0}return t},i.debounce=function(e,t,r){var n=void 0;return function(){var i=this,a=arguments,o=function(){n=null,r||e.apply(i,a)},s=r&&!n;clearTimeout(n),n=setTimeout(o,t),s&&e.apply(i,a)}}},{"../geo":299,"./log":352,"./thread":357,"babel-runtime/core-js/get-iterator":4,"babel-runtime/core-js/json/stringify":6,"babel-runtime/core-js/math/log2":8,"babel-runtime/core-js/object/keys":15,"babel-runtime/core-js/promise":17,"babel-runtime/helpers/toConsumableArray":28,"babel-runtime/helpers/typeof":29,"babel-runtime/regenerator":30,"js-yaml":190}],359:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n=JSON.parse('{\n "name": "tangram",\n "version": "0.10.4",\n "description": "WebGL Maps for Vector Tiles",\n "repository": {\n "type": "git",\n "url": "git://github.com/tangrams/tangram.git"\n },\n "main": "dist/tangram.min.js",\n "homepage": "https://github.com/tangrams/tangram",\n "keywords": [\n "maps",\n "graphics",\n "rendering",\n "visualization",\n "WebGL",\n "OpenStreetMap"\n ],\n "scripts": {\n "start": "npm run watch",\n "test": "npm run lint && npm run build-test && npm run test-local",\n "test-ci": "npm run lint && npm run build-test && npm run test-remote",\n "test-remote": "./node_modules/karma/bin/karma start --browsers SL_Firefox --single-run",\n "test-local": "./node_modules/karma/bin/karma start --browsers Chrome --single-run",\n "karma-start": "./node_modules/karma/bin/karma start --browsers Chrome --no-watch",\n "karma-run": "./node_modules/karma/bin/karma run --browsers Chrome",\n "lint": "$(npm bin)/jshint src/ && jshint test/",\n "build": "npm run build-bundle -- -o dist/tangram.debug.js && npm run build-minify",\n "build-test": "npm run build-bundle -- -o dist/tangram.test.js",\n "build-debug": "npm run build-bundle -- -o dist/tangram.debug.js",\n "build-bundle": "$(npm bin)/browserify src/module.js -t [ babelify --presets [ es2015 ] --plugins transform-runtime ] -t brfs -s Tangram -p browserify-derequire --debug",\n "build-minify": "$(npm bin)/uglifyjs dist/tangram.debug.js -c warnings=false -m -o dist/tangram.min.js && npm run build-size",\n "build-size": "gzip dist/tangram.min.js -c | wc -c | awk \'{kb=$1/1024; print kb}\' OFMT=\'%.0fk minified+gzipped\'",\n "watch": "$(npm bin)/budo src/module.js:dist/tangram.debug.js --port 8000 --cors --live -- -t [ babelify --presets [ es2015 ] --plugins transform-runtime ] -t brfs -s Tangram"\n },\n "author": {\n "name": "Mapzen",\n "email": "tangram@mapzen.com"\n },\n "contributors": [\n {\n "name": "Brett Camper"\n },\n {\n "name": "Peter Richardson"\n },\n {\n "name": "Patricio Gonzalez Vivo"\n },\n {\n "name": "Karim Naaji"\n },\n {\n "name": "Ivan Willig"\n },\n {\n "name": "Lou Huang"\n },\n {\n "name": "David Valdman"\n }\n ],\n "license": "MIT",\n "dependencies": {\n "babel-runtime": "6.11.6",\n "box-intersect": "1.0.0",\n "brfs": "1.4.3",\n "csscolorparser": "1.0.3",\n "earcut": "2.1.1",\n "fontfaceobserver": "1.7.1",\n "geojson-vt": "2.1.6",\n "gl-mat3": "1.0.0",\n "gl-mat4": "1.1.4",\n "gl-shader-errors": "1.0.3",\n "js-yaml": "tangrams/js-yaml#read-only",\n "jszip": "tangrams/jszip#read-only",\n "match-feature": "tangrams/match-feature#v1.3.1",\n "pbf": "1.3.2",\n "strip-comments": "0.3.2",\n "topojson": "1.6.19",\n "vector-tile": "1.1.2"\n },\n "devDependencies": {\n "babelify": "7.3.0",\n "babel-plugin-transform-runtime": "6.12.0",\n "babel-preset-es2015": "6.13.2",\n "browserify": "13.0.1",\n "browserify-derequire": "0.9.4",\n "budo": "8.2.1",\n "chai": "1.9.2",\n "chai-as-promised": "4.1.1",\n "glob": "4.0.6",\n "jshint": "jshint/jshint#3a8efa979dbb157bfb5c10b5826603a55a33b9ad",\n "karma": "0.12.23",\n "karma-browserify": "5.1.0",\n "karma-chrome-launcher": "0.1.4",\n "karma-mocha": "0.1.9",\n "karma-mocha-reporter": "1.0.0",\n "karma-sauce-launcher": "tangrams/karma-sauce-launcher#firefox-profiles",\n "karma-sinon": "1.0.4",\n "mocha": "1.21.4",\n "sinon": "1.10.3",\n "uglify-js": "2.4.14",\n "yargs": "1.3.2"\n }\n}\n'),i=void 0;r.default=i="v"+n.version},{}],360:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function i(e){var t=[];"string"==typeof e&&(t=e.split("."),e=t.pop());for(var r=M,n=0;n<t.length;n++){if(!r[t[n]])return[];r=r[t[n]]}return[e,r]}function a(){var e=0,t=new k.default;f.postMessage=function(e,t){for(var r=arguments.length,n=Array(r>2?r-2:0),i=2;r>i;i++)n[i-2]=arguments[i];if(Array.isArray(e))return x.default.all(e.map(function(e){var r;return(r=f).postMessage.apply(r,[e,t].concat(y.default(n)))}));var a=new x.default(function(e,r){j[R]={method:t,message:n,resolve:e,reject:r}}),o=void 0,s=[];return n&&1===n.length&&n[0]instanceof f.withTransferables&&(s=n[0].transferables,n=n[0].value),o={type:"main_send",message_id:R,method:t,message:n},o=u(o,s),e.postMessage(o,s.map(function(e){return e.object})),l(s),s.length>0&&S.default("trace","'"+t+"' transferred "+s.length+" objects to worker thread"),R++,a},f.addWorker=function(r){if(!(r instanceof Worker))throw Error("Worker broker could not add non-Worker object",r);t.set(r,e++),r.addEventListener("message",function(e){var t=c(e.data),n=t.message_id;if("worker_reply"===t.type)j[n]&&(t.error?j[n].reject(t.error):j[n].resolve(t.message),delete j[n]);else if("worker_send"===t.type&&null!=n){var a,o,s,h,d;!function(){var e=i(t.method),c=g.default(e,2);if(a=c[0],o=c[1],!o)throw Error("Worker broker could not dispatch message type "+t.method+" on target "+t.target+" because no object with that name is registered on main thread");if(s="function"==typeof o[a]&&o[a],!s)throw Error("Worker broker could not dispatch message type "+t.method+" on target "+t.target+" because object has no method with that name");try{h=s.apply(o,t.message)}catch(p){d=p}var m=void 0,_=[];h instanceof x.default?h.then(function(e){e instanceof f.withTransferables&&(_=e.transferables,e=e.value),m={type:"main_reply",message_id:n,message:e},m=u(m,_),r.postMessage(m,_.map(function(e){return e.object})),l(_),_.length>0&&S.default("trace","'"+a+"' transferred "+_.length+" objects to worker thread")},function(e){r.postMessage({type:"main_reply",message_id:n,error:e instanceof Error?e.message+": "+e.stack:e})}):(h instanceof f.withTransferables&&(_=h.transferables,h=h.value),m={type:"main_reply",message_id:n,message:h,error:d instanceof Error?d.message+": "+d.stack:d},m=u(m,_),r.postMessage(m,_.map(function(e){return e.object})),l(_),_.length>0&&S.default("trace","'"+a+"' transferred "+_.length+" objects to worker thread"))}()}})},f.removeWorker=function(e){if(!t.has(e))throw Error("Worker broker could not remove unregistered object",e);t.delete(e)},f.getMessages=function(){return j},f.getMessageId=function(){return R}}function o(){f.postMessage=function(e){for(var t=arguments.length,r=Array(t>1?t-1:0),n=1;t>n;n++)r[n-1]=arguments[n];var i=new x.default(function(t,n){j[R]={method:e,message:r,resolve:t,reject:n}}),a=void 0,o=[];return r&&1===r.length&&r[0]instanceof f.withTransferables&&(o=r[0].transferables,r=r[0].value),a={type:"worker_send",message_id:R,method:e,message:r},a=u(a,o),self.postMessage(a,o.map(function(e){return e.object})),l(o),o.length>0&&S.default("trace","'"+e+"' transferred "+o.length+" objects to main thread"),R++,i},self.addEventListener("message",function(e){var t=c(e.data),r=t.message_id;if("main_reply"===t.type)j[r]&&(t.error?j[r].reject(t.error):j[r].resolve(t.message),delete j[r]);else if("main_send"===t.type&&null!=r){var n,a,o,s,h;!function(){var e=i(t.method),c=g.default(e,2);if(n=c[0],a=c[1],!a)throw Error("Worker broker could not dispatch message type "+t.method+" on target "+t.target+" because no object with that name is registered on main thread");if(o="function"==typeof a[n]&&a[n],!o)throw Error("Worker broker could not dispatch message type "+t.method+" because worker has no method with that name");try{s=o.apply(a,t.message)}catch(d){h=d}var p=void 0,m=[];s instanceof x.default?s.then(function(e){e instanceof f.withTransferables&&(m=e.transferables,e=e.value),p={type:"worker_reply",message_id:r,message:e},p=u(p,m),self.postMessage(p,m.map(function(e){return e.object})),l(m),m.length>0&&S.default("trace","'"+n+"' transferred "+m.length+" objects to main thread") 20 },function(e){self.postMessage({type:"worker_reply",message_id:r,error:e instanceof Error?e.message+": "+e.stack:e})}):(s instanceof f.withTransferables&&(m=s.transferables,s=s.value),p={type:"worker_reply",message_id:r,message:s,error:h instanceof Error?h.message+": "+h.stack:h},p=u(p,m),self.postMessage(p,m.map(function(e){return e.object})),l(m),m.length>0&&S.default("trace","'"+n+"' transferred "+m.length+" objects to main thread"))}()}})}function s(e){var t=arguments.length<=1||void 0===arguments[1]?null:arguments[1],r=arguments.length<=2||void 0===arguments[2]?null:arguments[2],n=arguments.length<=3||void 0===arguments[3]?[]:arguments[3];if(!e)return n;if(Array.isArray(e))e.forEach(function(t,r){return s(t,e,r,n)});else if("object"===("undefined"==typeof e?"undefined":m.default(e)))if(e instanceof ArrayBuffer)n.push({object:e,parent:t,property:r});else if(e.buffer instanceof ArrayBuffer)n.push({object:e.buffer,parent:t,property:r});else for(var i in e)s(e[i],e,i,n);return n}function l(e){Array.isArray(e)&&e.filter(function(e){return e.parent&&e.property}).forEach(function(e){return delete e.parent[e.property]})}function u(e,t){return 0===t.length&&(e=d.default(e)),e}function c(e){return"string"==typeof e?JSON.parse(e):e}Object.defineProperty(r,"__esModule",{value:!0});var f,h=e("babel-runtime/core-js/json/stringify"),d=n(h),p=e("babel-runtime/helpers/typeof"),m=n(p),_=e("babel-runtime/helpers/slicedToArray"),g=n(_),v=e("babel-runtime/helpers/toConsumableArray"),y=n(v),b=e("babel-runtime/core-js/promise"),x=n(b),w=e("babel-runtime/core-js/map"),k=n(w),A=e("./thread"),T=n(A),E=e("./log"),S=n(E);r.default=f={};var R=0,j={},M={};f.addTarget=function(e,t){M[e]=t},f.withTransferables=function(){for(var e=arguments.length,t=Array(e),r=0;e>r;r++)t[r]=arguments[r];return this instanceof f.withTransferables?(this.value=t,void(this.transferables=s(this.value))):new(Function.prototype.bind.apply(f.withTransferables,[null].concat(t)))},T.default.is_main&&a(),T.default.is_worker&&o()},{"./log":352,"./thread":357,"babel-runtime/core-js/json/stringify":6,"babel-runtime/core-js/map":7,"babel-runtime/core-js/promise":17,"babel-runtime/helpers/slicedToArray":27,"babel-runtime/helpers/toConsumableArray":28,"babel-runtime/helpers/typeof":29}],361:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(r,"__esModule",{value:!0});var i,a=e("babel-runtime/helpers/slicedToArray"),o=n(a);r.default=i={},i.set=function(e){for(var t=[],r=e.length,n=0;r>n;n++)t[n]=e[n];return t},i.neg=function(e){for(var t=[],r=e.length,n=0;r>n;n++)t[n]=-1*e[n];return t},i.add=function(e,t){for(var r=[],n=Math.min(e.length,t.length),i=0;n>i;i++)r[i]=e[i]+t[i];return r},i.sub=function(e,t){for(var r=[],n=Math.min(e.length,t.length),i=0;n>i;i++)r[i]=e[i]-t[i];return r},i.signed_area=function(e,t,r){return(t[0]-e[0])*(r[1]-e[1])-(r[0]-e[0])*(t[1]-e[1])},i.mult=function(e,t){var r,n=[],i=e.length;if("number"==typeof t)for(r=0;i>r;r++)n[r]=e[r]*t;else for(i=Math.min(e.length,t.length),r=0;i>r;r++)n[r]=e[r]*t[r];return n},i.div=function(e,t){var r,n=[];if("number"==typeof t)for(r=0;r<e.length;r++)n[r]=e[r]/t;else{var i=Math.min(e.length,t.length);for(r=0;i>r;r++)n[r]=e[r]/t[r]}return n},i.perp=function(e,t){return[t[1]-e[1],e[0]-t[0]]},i.rot=function(e,t){var r=Math.cos(t),n=Math.sin(t);return[e[0]*r-e[1]*n,e[0]*n+e[1]*r]},i.angle=function(e){var t=o.default(e,2),r=t[0],n=t[1];return Math.atan2(n,r)},i.angleBetween=function(e,t){var r=i.dot(e,t);return-1>r&&(r=-1),Math.acos(r)},i.isEqual=function(e,t){for(var r=e.length,n=0;r>n;n++)if(e[n]!==t[n])return!1;return!0},i.lengthSq=function(e){return 2===e.length?e[0]*e[0]+e[1]*e[1]:e.length>=3?e[0]*e[0]+e[1]*e[1]+e[2]*e[2]:0},i.length=function(e){return Math.sqrt(i.lengthSq(e))},i.normalize=function(e){var t;return 2===e.length?(t=e[0]*e[0]+e[1]*e[1],t=Math.sqrt(t),0!==t?[e[0]/t,e[1]/t]:[0,0]):e.length>=3&&(t=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],t=Math.sqrt(t),0!==t)?[e[0]/t,e[1]/t,e[2]/t]:[0,0,0]},i.cross=function(e,t){return[e[1]*t[2]-e[2]*t[1],e[2]*t[0]-e[0]*t[2],e[0]*t[1]-e[1]*t[0]]},i.dot=function(e,t){for(var r=0,n=Math.min(e.length,t.length),i=0;n>i;i++)r+=e[i]*t[i];return r}},{"babel-runtime/helpers/slicedToArray":27}],362:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(r,"__esModule",{value:!0});var i=e("babel-runtime/helpers/slicedToArray"),a=n(i),o=e("babel-runtime/core-js/object/keys"),s=n(o),l=e("babel-runtime/helpers/classCallCheck"),u=n(l),c=e("babel-runtime/helpers/createClass"),f=n(c),h=e("./geo"),d=n(h),p=e("./tile"),m=n(p),_=e("./camera"),g=n(_),v=e("./utils/utils"),y=n(v),b=e("./utils/subscribe"),x=n(b),w=e("./utils/log"),k=n(w),A=function(){function e(t,r){u.default(this,e),x.default(this),this.scene=t,this.createMatrices(),this.zoom=null,this.center=null,this.bounds=null,this.meters_per_pixel=null,this.panning=!1,this.zooming=!1,this.zoom_direction=0,this.size={css:{},device:{},meters:{}},this.aspect=null,this.buffer=0,this.continuous_zoom="boolean"==typeof r.continuousZoom?r.continuousZoom:!0,this.tile_simplification_level=0,this.preserve_tiles_within_zoom=1,this.reset()}return f.default(e,[{key:"reset",value:function(){this.createCamera()}},{key:"createCamera",value:function(){var e=this.getActiveCamera();e&&(this.camera=g.default.create(e,this,this.scene.config.cameras[e]),this.camera.updateView())}},{key:"getActiveCamera",value:function(){if(this.scene.config&&this.scene.config.cameras){for(var e in this.scene.config.cameras)if(this.scene.config.cameras[e].active)return e;var t=s.default(this.scene.config.cameras);return t.length&&t[0]}}},{key:"setActiveCamera",value:function(e){var t=this.getActiveCamera();return this.scene.config.cameras[e]&&(this.scene.config.cameras[e].active=!0,t&&t!==e&&this.scene.config.cameras[t]&&delete this.scene.config.cameras[t].active),this.scene.updateConfig({rebuild:!1}),this.getActiveCamera()}},{key:"update",value:function(){this.camera.update()}},{key:"setViewportSize",value:function(e,t){this.size.css={width:e,height:t},this.size.device={width:Math.round(this.size.css.width*y.default.device_pixel_ratio),height:Math.round(this.size.css.height*y.default.device_pixel_ratio)},this.aspect=this.size.css.width/this.size.css.height,this.updateBounds()}},{key:"setView",value:function(){var e=arguments.length<=0||void 0===arguments[0]?{}:arguments[0],t=e.lng,r=e.lat,n=e.zoom,i=!1;return"number"==typeof t&&"number"==typeof r&&(this.center&&t===this.center.lng&&r===this.center.lat||(i=!0,this.center={lng:d.default.wrapLng(t),lat:r})),"number"==typeof n&&n!==this.zoom&&(i=!0,this.setZoom(n)),i&&this.updateBounds(),i}},{key:"setZoom",value:function(e){this.zooming?this.zooming=!1:this.last_zoom=this.zoom;var t=this.tile_zoom,r=this.tileZoom(e);this.continuous_zoom||(e=r),r!==t&&(this.zoom_direction=r>t?1:-1),this.last_zoom=this.zoom,this.zoom=e,this.tile_zoom=r,this.updateBounds(),this.scene.requestRedraw()}},{key:"startZoom",value:function(){this.last_zoom=this.zoom,this.zooming=!0}},{key:"baseZoom",value:function(e){return Math.floor(e)}},{key:"tileZoom",value:function(e){return this.baseZoom(e)-this.tile_simplification_level}},{key:"styleZoom",value:function(e){return this.baseZoom(e)+this.tile_simplification_level}},{key:"ready",value:function(){return"number"!=typeof this.size.css.width||"number"!=typeof this.size.css.height||null==this.center||"number"!=typeof this.zoom?!1:!0}},{key:"updateBounds",value:function(){if(this.ready()){this.meters_per_pixel=d.default.metersPerPixel(this.zoom),this.size.meters={x:this.size.css.width*this.meters_per_pixel,y:this.size.css.height*this.meters_per_pixel};var e=d.default.latLngToMeters([this.center.lng,this.center.lat]),t=a.default(e,2),r=t[0],n=t[1];this.center.meters={x:r,y:n},this.center.tile=d.default.tileForMeters([this.center.meters.x,this.center.meters.y],this.tile_zoom),this.bounds={sw:{x:this.center.meters.x-this.size.meters.x/2,y:this.center.meters.y-this.size.meters.y/2},ne:{x:this.center.meters.x+this.size.meters.x/2,y:this.center.meters.y+this.size.meters.y/2}},this.scene.tile_manager.updateTilesForView(),this.trigger("move"),this.scene.requestRedraw()}}},{key:"findVisibleTileCoordinates",value:function(){if(!this.bounds)return[];for(var e=this.tile_zoom,t=d.default.tileForMeters([this.bounds.sw.x,this.bounds.sw.y],e),r=d.default.tileForMeters([this.bounds.ne.x,this.bounds.ne.y],e),n=[],i=t.x-this.buffer;i<=r.x+this.buffer;i++)for(var a=r.y-this.buffer;a<=t.y+this.buffer;a++)n.push(m.default.coord({x:i,y:a,z:e}));return n}},{key:"pruneTilesForView",value:function(){var e=this;if(this.ready()){var t=[Math.ceil((Math.floor(this.size.css.width/d.default.tile_size)+2)/2),Math.ceil((Math.floor(this.size.css.height/d.default.tile_size)+2)/2)];this.scene.tile_manager.removeTiles(function(r){if(r.visible||r.proxy_for)return!1;if(r.loading&&r.style_zoom!==e.tile_zoom)return!0;var n=Math.abs(r.style_zoom-e.tile_zoom);if(n>e.preserve_tiles_within_zoom)return!0;var i=m.default.coordinateAtZoom(r.coords,e.tile_zoom);return Math.abs(i.x-e.center.tile.x)-t[0]>e.buffer?(k.default("trace","View: remove tile "+r.key+" (as "+i.x+"/"+i.y+"/"+e.tile_zoom+") for being too far out of visible area ***"),!0):Math.abs(i.y-e.center.tile.y)-t[1]>e.buffer?(k.default("trace","View: remove tile "+r.key+" (as "+i.x+"/"+i.y+"/"+e.tile_zoom+") for being too far out of visible area ***"),!0):!1})}}},{key:"createMatrices",value:function(){this.matrices={},this.matrices.model=new Float64Array(16),this.matrices.model32=new Float32Array(16),this.matrices.model_view=new Float64Array(16),this.matrices.model_view32=new Float32Array(16),this.matrices.normal=new Float64Array(9),this.matrices.normal32=new Float32Array(9),this.matrices.inverse_normal32=new Float32Array(9)}},{key:"setupTile",value:function(e,t){e.setupProgram(this.matrices,t),this.camera.setupMatrices(this.matrices,t)}},{key:"setupProgram",value:function(e){e.uniform("2fv","u_resolution",[this.size.device.width,this.size.device.height]),e.uniform("3fv","u_map_position",[this.center.meters.x,this.center.meters.y,this.zoom]),e.uniform("1f","u_meters_per_pixel",this.meters_per_pixel),e.uniform("1f","u_device_pixel_ratio",y.default.device_pixel_ratio),this.camera.setupProgram(e)}}]),e}();r.default=A},{"./camera":298,"./geo":299,"./tile":346,"./utils/log":352,"./utils/subscribe":356,"./utils/utils":358,"babel-runtime/core-js/object/keys":15,"babel-runtime/helpers/classCallCheck":21,"babel-runtime/helpers/createClass":22,"babel-runtime/helpers/slicedToArray":27}]},{},[321])(321)});